I'm trying to use Data Proxy with lambda and getti...
# prisma-data-platform
m
I'm trying to use Data Proxy with lambda and getting the error
Copy code
Invoke Error 	{"errorType":"Error","errorMessage":"error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.\n  -->  schema.prisma:9\n   | \n 8 |   provider = \"postgresql\"\n 9 |   url      = env(\"DATABASE_URL\")\n   | \n\nValidation Error Count: 1","clientVersion":"3.6.0","stack":["Error: error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.","  -->  schema.prisma:9","   | "," 8 |   provider = \"postgresql\""," 9 |   url      = env(\"DATABASE_URL\")","   | ","","Validation Error Count: 1","    at Object.request (/node_modules/@prisma/client/runtime/index.js:39051:15)","    at Runtime.IY (/lib/lambdas/cognito/preSignUp.ts:25:23)"]}
• Generated 3.9.0 client with
PRISMA_CLIENT_ENGINE_TYPE='dataproxy' prisma generate
• Set my
DATABASE_URL
to
prisma://....
• Set
previewFeatures = ["dataProxy"]
in
generator client {}
What am I missing here?
j
This error comes from a standalone prisma bundle (not using Data Proxy). The fact that you see it means that your
prisma://
connection string makes it to the app through
DATABASE_URL
but the generated client is not expecting it. I would verify what you're bundling for your lambda (maybe there is a generation step in your deployment process that doesn't change the client type?). Also: you mention you generate 3.9 client but the error message mentions 3.6 so it may suggest some mixup in your setup
m
hm that's a good point about the version
i don't think there are any other client generation steps, i checked the schema.prisma file in the bundle to make sure it had dataProxy enabled
j
how do you deploy to lambda?
m
i'm using Serverless Stack and CDK
j
Can you grab the zip file used for the lambda function? The first step to confirm that the client used in lambda doesn't use data proxy would be to take a look at
node_modules/.prisma/client/index.js
and search for
engineType
. I'd expect to see
dataproxy
for
engineType
but if it's different, it means that you don't use a data-proxy-enabled client
m
hm I don't see
engineType