TypeError: Cannot read properties of undefined (reading 'MongoDBSessionStorage')

Topic summary

Issue: Developers encountered a TypeError: Cannot read properties of undefined (reading 'MongoDBSessionStorage') when configuring MongoDB session storage for Shopify apps.

Root Cause: The error stems from an incorrect import path in the Shopify API library. Users were attempting to access Shopify.Auth.Session.MongoDBSessionStorage, which doesn’t exist in certain library versions.

Solution: Remove Auth from the path:

  • Incorrect: Shopify.Auth.Session.MongoDBSessionStorage
  • Correct: Shopify.Session.MongoDBSessionStorage

Additional Context:

  • The solution was originally shared on Discord by another developer
  • Shopify’s JS library has undergone significant changes; newer versions use a different package structure (see @shopify/shopify-app-session-storage-mongodb)
  • Multiple users confirmed this fix resolved their connection issues
  • The error occurred even with verified MongoDB credentials that worked outside the Shopify context
Summarized with AI on November 22. AI used: claude-sonnet-4-5-20250929.

Get rid of Auth. Just use Shopify.Session.MongoDBSessionStorage

The solution is from another dev in Discord:

https://discord.com/channels/842813079926603828/851506171377614858/1001542244207169657

2 Likes