Skip to content

Shared Monorepo Prisma Client doesn't work in newer shopify-app-session-storage-prisma version #3015

@dizzyjaguar

Description

@dizzyjaguar

Issue summary

Before opening this issue, I have:

  • [ x] Upgraded to the latest version of the relevant packages
    • @shopify/* package and version: 8.0.1
    • Node version:
    • Operating system:
  • [x ] Set { logger: { level: LogSeverity.Debug } } in my configuration, when applicable
  • [ x] Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • [ x] Looked for similar issues in this repository
  • [ x] Checked that this isn't an issue with a Shopify API

shopify-app-session-storage-prisma gives an error with the newer versions of the package when I'm in a monorepo situation where the Prisma files are in a shared monorepo package that is imported into the app.

I've downgraded back to version 4.0.5 and everything still works as expected

Expected behavior

It should work as it did before, without throwing

Actual behavior

App crashes and throws:

TypeError: Right-hand side of 'instanceof' is not an object
    at PrismaSessionStorage.storeSession (/app/node_modules/@shopify/src/prisma.ts:74:14)  

Steps to reproduce the problem

  1. Create Shopify RR7 app in monorepo
  2. Place Prisma client in a shared package
  3. Import the built shared Prisma Client
  4. Use that Prisma Client in the sessionStorage: new PrismaSessionStorage(prisma),

Debug logs

TypeError: Right-hand side of 'instanceof' is not an object
    at PrismaSessionStorage.storeSession (/app/node_modules/@shopify/src/prisma.ts:74:14)
    at Object.authenticate (file:///app/node_modules/@shopify/src/server/authenticate/admin/strategies/token-exchange.ts:113:7)
    at Object.authenticateAdmin [as admin] (file:///app/node_modules/@shopify/src/server/authenticate/admin/authenticate.ts:172:23)
    at loader$e (file:///app/apps/web/build/server/index.js:1552:7)
    at callRouteHandler (file:///app/node_modules/react-router/dist/development/chunk-4LKRSAEJ.mjs:509:16)
    at commonRoute.loader (file:///app/node_modules/react-router/dist/development/chunk-4LKRSAEJ.mjs:659:19)
    at file:///app/node_modules/react-router/dist/development/chunk-JZWAC4HX.mjs:4756:19
    at callLoaderOrAction (file:///app/node_modules/react-router/dist/development/chunk-JZWAC4HX.mjs:4808:16)
    at async Promise.all (index 0)
    at defaultDataStrategy (file:///app/node_modules/react-router/dist/development/chunk-JZWAC4HX.mjs:4433:17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions