Update package to work with prisma 6
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
PR is here: https://github.com/prisma/extension-read-replicas/pull/42. You could test it and upvote it if it works for you. :-)
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)
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
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
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 })),
})
);
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?
@nurul3101 I confirm the problem was solved. I have been using it on high-traffic production for 2 days already.
We've also been operating it in production for a while – seems fine.