P
Prisma5w ago
Vajr

How to use prisma accelerate on edge functions in local environment?

I created a local db in docker but it fails locally when the edge middleware is called.
No description
8 Replies
RaphaelEtim
RaphaelEtim5w ago
Hi @Vajr Can you please take a look at this documentation?
Accelerate: Local development | Prisma Documentation
Learn how to use Prisma Accelerate in a development environment.
Vajr
VajrOP5w ago
i tried everything mentioned here and still had the issue. maybe i will try again tomorrow as the day is wrapping up. and see if i missed something and report back
RaphaelEtim
RaphaelEtim5w ago
Were you getting any errors?
Vajr
VajrOP5w ago
while the edge middlewware ran, yes
RaphaelEtim
RaphaelEtim5w ago
Can you please share it?
Vajr
VajrOP4w ago
{"name":"PrismaClientValidationError","source":"edge-server","message":"Invalid client engine type, please use library or binary","stack":"PrismaClientValidationError: Invalid client engine type, please use library or binary\n at gs (webpack-internal:///(middleware)/./node_modules/@prisma/client/runtime/edge.js:12:65)\n this is the error i am getting my env vars: DATABASE_URL="postgresql://admin:admin@localhost:26257/defaultdb?sslmode=disable" DIRECT_DATABASE_URL="postgresql://admin:admin@localhost:26257/defaultdb?sslmode=disable" it works for everything except for edge middleware in nextjs If I read this right, does the doc suggest another remote db for connection pooling? besides the one that i have locally?
RaphaelEtim
RaphaelEtim4w ago
Hi @Vajr Can you try adding engineType = "library" to the generator block in schema.prisma file and check if that resolves the issue?
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-js"
engineType = "library"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

generator client {
provider = "prisma-client-js"
engineType = "library"
}
Vajr
VajrOP4w ago
yeah, i tried that as well. The documentation seems vague but what i understand is that regular non 'edge' use of prsima accelerate works fine on a local db instance but if i am using it on edge middleware or cloudflare workers then there is no other option but to use a remotely hosted db instance.
Want results from more Discord servers?
Add your server