ReferenceError: sanitizeShop is not defined

Topic summary

A developer encounters a ReferenceError: sanitizeShop is not defined error when working with Shopify’s custom session storage implementation.

Error Details:

  • The error originates from CustomSessionStorage failing to find sessions by shop
  • Occurs in the @shopify/shopify-api package during session storage operations
  • Results in a SessionStorageError that crashes the application

Technical Context:

  • The stack trace points to custom session storage authentication code
  • The sanitizeShop function is being called but hasn’t been imported or defined in the custom session storage implementation
  • The application is running with nodemon, which detects the crash

Likely Cause:
The developer’s custom session storage class is missing an import or definition for the sanitizeShop utility function, which is typically provided by the Shopify API library for validating shop domains.

Status: The issue remains unresolved with no responses yet.

Summarized with AI on November 24. AI used: claude-sonnet-4-5-20250929.

[email removed]
2022-12-07 05:47:39 | backend | var _this = _super.apply(this, tslib_1.__spreadArray(, tslib_1.__read(args), false)) || this;
2022-12-07 05:47:39 | backend | ^
2022-12-07 05:47:39 | backend |
2022-12-07 05:47:39 | backend | SessionStorageError: CustomSessionStorage failed to find sessions by shop. Error Details: ReferenceError: sanitizeShop
is not defined
2022-12-07 05:47:39 | backend | at SessionStorageError.ShopifyError [as constructor]
([email removed]
2022-12-07 05:47:39 | backend | at new SessionStorageError [email removed]
2022-12-07 05:47:39 | backend | at CustomSessionStorage.
([email removed]
2022-12-07 05:47:39 | backend | at step (C:\dev\smshopify\web\node_modules\tslib\tslib.js:144:27)
2022-12-07 05:47:39 | backend | at Object.throw (C:\dev\smshopify\web\node_modules\tslib\tslib.js:125:57)
2022-12-07 05:47:39 | backend | at rejected (C:\dev\smshopify\web\node_modules\tslib\tslib.js:116:69)
2022-12-07 05:47:39 | backend | at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-12-07 05:47:39 | backend |
2022-12-07 05:47:39 | backend | [nodemon] app crashed - waiting for file changes before starting…
2022-12-07 05:47:39 | backend |