Skip to content

Update package to work with prisma 6 #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shadoworion opened this issue Dec 2, 2024 · 7 comments · May be fixed by #42
Open

Update package to work with prisma 6 #41

shadoworion opened this issue Dec 2, 2024 · 7 comments · May be fixed by #42

Comments

@shadoworion
Copy link

Update package to work with prisma 6

npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: @prisma/[email protected]
npm error node_modules/@prisma/client
npm error   @prisma/client@"6.0.1" from the root project
npm error
npm error Could not resolve dependency:
npm error peer @prisma/client@"^5.2.0" from @prisma/[email protected]
npm error node_modules/@prisma/extension-read-replicas
npm error   @prisma/extension-read-replicas@"0.4.0" from the root project
@clemens
Copy link

clemens commented Dec 17, 2024

PR is here: #42. You could test it and upvote it if it works for you. :-)

@clemens clemens linked a pull request Dec 17, 2024 that will close this issue
@shadoworion
Copy link
Author

From prisma 6.2+ it's not working at all.

TypeError: Cannot read properties of undefined (reading 'findFirst')
    at Array.$allOperations (/backend/node_modules/@prisma/extension-read-replicas/dist/index.js:146:34)
    at /backend/node_modules/@prisma/client-postgresql/runtime/library.js:31:9170
    at i (/backend/node_modules/@prisma/client-postgresql/runtime/library.js:121:1016)
    at PrismaPromise.then (/backend/node_modules/@prisma/client-postgresql/runtime/library.js:121:1091)

@lukebelbina
Copy link

lukebelbina commented Jan 11, 2025

Can confirm the current 0.4.0 version is not working on 6.2.1

 error     unhandledRejection: client.$disconnect is not a function
TypeError: client.$disconnect is not a function
    at /home/luke/github/podengine/pod-engine-monorepo/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_/node_modules/@prisma/extension-read-replicas/dist/index.js:52:67

@meotimdihia
Copy link

meotimdihia commented Jan 18, 2025

Same here, it doesn't work with Prisma ^6.2.1


 TypeError: Cannot read properties of undefined (reading 'groupBy')
 TypeError: Cannot read properties of undefined (reading 'groupBy')
               at Array.$allOperations (file:///Users/meotimdihia/Sources/xxxxxxx/node_modules/.pnpm/@[email protected]_@[email protected]/node_modules/@prisma/extension-read-replicas/dist/index.mjs:120:34)
               at /Users/meotimdihia/Sources/xxxxxxxx/node_modules/.pnpm/@[email protected][email protected]/node_modules/@prisma/client/runtime/library.js:31:9170
  

@yharaskrik
Copy link

For anyone running into issues with >= Prisma 6.2, you can get around it by initializing PrismaClients with the constructor and passing them into the extension as replicas, rather than urls.

    return client
        .$extends(
            readReplicas({
                replicas: (readonlyUrls ?? []).map((url) => new PrismaClient({ datasourceUrl: url })),
            })
        );

@nurul3101
Copy link
Member

Hey everyone!

We released a new version of read-replicas extension - 0.4.1.

https://www.npmjs.com/package/@prisma/extension-read-replicas

Can you please upgrade to the latest version and confirm if the issue is resolved?

@meotimdihia
Copy link

meotimdihia commented Mar 27, 2025

@nurul3101 I confirm the problem was solved. I have been using it on high-traffic production for 2 days already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants