P
Prisma3w ago
z

Error when using accelerate (Local Development)

ref: https://www.prisma.io/docs/accelerate/local-development i did run prisma generate after updating DB URL. im using sveltekit and postgres db. .env
DATABASE_URL="postgresql://postgres:root@localhost:5432/docker"
DIRECT_DATABASE_URL="postgresql://postgres:root@localhost:5432/docker"
DATABASE_URL="postgresql://postgres:root@localhost:5432/docker"
DIRECT_DATABASE_URL="postgresql://postgres:root@localhost:5432/docker"
error
[redacted]/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_/node_modules/@prisma/extension-accelerate/dist/esm/extension.js:75
.then(() => client._engine.apiKey());
^

TypeError: client._engine.apiKey is not a function
at [redacted]/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_/node_modules/@prisma/extension-accelerate/dist/esm/extension.js:75:40

Node.js v20.10.0
[redacted]/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_/node_modules/@prisma/extension-accelerate/dist/esm/extension.js:75
.then(() => client._engine.apiKey());
^

TypeError: client._engine.apiKey is not a function
at [redacted]/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_/node_modules/@prisma/extension-accelerate/dist/esm/extension.js:75:40

Node.js v20.10.0
schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch", "tracing"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["fullTextSearch", "tracing"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_DATABASE_URL")
}
database.ts
import { PrismaClient } from '@prisma/client';
import { withAccelerate } from '@prisma/extension-accelerate';

const prisma = new PrismaClient().$extends(withAccelerate());

export { prisma as db };
import { PrismaClient } from '@prisma/client';
import { withAccelerate } from '@prisma/extension-accelerate';

const prisma = new PrismaClient().$extends(withAccelerate());

export { prisma as db };
versions
"dependencies": {
...
"@prisma/client": "^5.20.0",
"@prisma/extension-accelerate": "^1.2.0",
"@prisma/extension-optimize": "^1.0.1",
"prisma": "^5.20.0",
...
}
"dependencies": {
...
"@prisma/client": "^5.20.0",
"@prisma/extension-accelerate": "^1.2.0",
"@prisma/extension-optimize": "^1.0.1",
"prisma": "^5.20.0",
...
}
Accelerate: Local development | Prisma Documentation
Learn how to use Prisma Accelerate in a development environment.
13 Replies
z
z3w ago
Any solutions or confirmation that this is indeed a bug?
samuelcole
samuelcole3w ago
i had the same bug when upgrading to 1.2.0: https://discord.com/channels/937751382725886062/1290391123633770589 i've downgraded while waiting for them to fix @Nurul (Prisma)
z
z3w ago
okay
Nurul
Nurul3w ago
@z For you this issue happened only after upgrading extension version to 1.2.0? Also, can you confirm if the issue got resolved after downgrading to 1.1.0?
z
z3w ago
i was testing it out for the 1st time, according to the docs you can pass localhost and it will just work, but that wasn’t the case so i removed it all together easy to replicate, try using localhost with accelerate and you will get this error ill check and let you know okay yes can confirm downgrading fixes the issue.
Nurul
Nurul3w ago
Thanks for testing. I'll reproduce it on my end and will raise it with the team 👍 I was able to reproduce this. We will do a patch release to fix it. Thanks for reporting! Will inform you once the patch release is out.
z
z3w ago
:heart:
Nurul
Nurul3w ago
@z We have released a new patch version for Accelerate extension. The issue should be resolved in this new version. Can you try the new version 1.2.1 and check?
z
z2w ago
can confirm its fixed now @Nurul (Prisma) I think theres is this another bug where if you have accelerate, optimize can not record the queries ok i fixed that, optimize should be passed 1st and then accelerate when extending but another bug:
TypeError: Do not know how to serialize a BigInt
TypeError: Do not know how to serialize a BigInt
when using optimize causes it to crash
Nurul
Nurul2w ago
Can you share steps on how can I reproduce the BigInt error?
z
z2w ago
not sure, I think its just because i have a bigint field in db Have a schema with bigint, insert value in db make a fetch req for it while optimize is on
Nurul
Nurul2w ago
I was able to reproduce this, but I don't think this is related to Optimize. The error occured even if I commented out Optimize extension. @z Can you confirm if you get the same error even when you comment out Optimize? Btw thank you so much for reporting these issues. We really appreciate it! It helps us in improving! 🙏
z
z2w ago
the error does not happen when i comment out Optimize
Want results from more Discord servers?
Add your server