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.
8 Replies
Accelerate: Local development | Prisma Documentation
Learn how to use Prisma Accelerate in a development environment.
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
Were you getting any errors?
while the edge middlewware ran, yes
Can you please share it?
{"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?Hi @Vajr
Can you try adding
engineType = "library"
to the generator block in schema.prisma
file and check if that resolves the issue?
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.