TypeError: client._engine.apiKey is not a function

node_modules/@prisma/extension-accelerate/dist/cjs/extension.js:81:40
node_modules/@prisma/extension-accelerate/dist/cjs/extension.js:81:40
I'm having trouble starting my prisma client locally, do I need to login or something?
13 Replies
samuelcole
samuelcole3w ago
this is happening in production now, so it's a bit more urgent happening to this person as well: https://discord.com/channels/937751382725886062/1289351062859288608/1289351062859288608
Nurul
Nurul3w ago
Hey @samuelcole Did this started happening randomly? When exactly do you get this error?
samuelcole
samuelcole3w ago
it started five days ago when i upgraded from 1.1.0 to 1.2.0 i think it's a race-condition, it seems to happen rarely is there a changelog? i'm not sure what changed in 1.2.0 @Nurul (Prisma) fyi: i'm downgrading to 1.1.0 until this is resolved
Raj
Raj3w ago
Also encountering issues with Accelerate 1.2.0, albeit different from what you've listed: 1. I keep getting runtime errors saying that my ACCELERATE_DB_URL env var isn't found (when it is and the queries are clearly running) 2. My exported client/singleton is running into type inference issues
Nurul
Nurul3w ago
@Raj Does your error go away if you downgrade to Accelerate extension version 1.1.0?
Raj
Raj3w ago
Yes
Nurul
Nurul3w ago
Thanks, I was able to reproduce this as well. We will do a patch release to fix it. Thanks for reporting. I'll inform you once the patch release is out
Raj
Raj3w ago
❤️
Nurul
Nurul2w ago
@Raj @samuelcole We have released a new patch version of Accelerate extension which should fix the issue. Can you try installing the version 1.2.1 and check?
samuelcole
samuelcole2w ago
i think that fixed it! thanks
Raj
Raj2w ago
@Nurul (Prisma) I'm still getting issues w/ being unable to find the env var: https://i.raj.wtf/imgs/t70I24mparbnlbXy02EuMDzeyU6.png though, saying that, I might need to revisit the way that my @db internal package is bundled/distributed across my codebase. I'm assuming the issue is occurring due to the client making its way to the browser instead of staying purely on the server (though the only other thing that gets exported is the type defs)
Nurul
Nurul2w ago
Hey @Raj I think the issue you are observing is not related to Accelerate extension. The cause of your error seems different. The env variable is not found. I agree about checking how your internal package is bundled and whether it has access to internal variables or not.
Raj
Raj2w ago
Yeah, Next.js was bundling the types & client together even when only the types were being used. I split my imports from @acme/db to @acme/db/client & @acme/db/types and now that runtime error has stopped. The only thing is that I get this TS inference error for the exported client singleton https://i.raj.wtf/imgs/LiwJoixTFq4KxF3Tpl7AkLcJzMu.png
Want results from more Discord servers?
Add your server