z
z
Explore posts from servers
PPrisma
Created by z on 9/27/2024 in #help-and-questions
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",
...
}
27 replies