I am randomly facing an error on my server: ```err...
# orm-help
s
I am randomly facing an error on my server:
Copy code
error: Error validating datasource `db`: the URL must start with the protocol `mysql://`.
Now the thing is my
DATABASE_URL
is present in my Lambda configuration and when I log it, it does even print it. Don’t know why this is happening.. any idea? Full error message:
Copy code
"Runtime.UnhandledPromiseRejection: Error: error: Error validating datasource `db`: the URL must start with the protocol `mysql://`.",
        "  -->  schema.prisma:3",
        "   | ",
        " 2 |   provider             = \"mysql\"",
        " 3 |   url                  = env(\"DATABASE_URL\")",
        "   | ",
        "",
        "Validation Error Count: 1",
        "    at process.<anonymous> (file:///var/runtime/index.mjs:1131:17)",
        "    at process.emit (node:events:527:28)",
        "    at emit (node:internal/process/promises:140:20)",
        "    at processPromiseRejections (node:internal/process/promises:274:27)",
        "    at processTicksAndRejections (node:internal/process/task_queues:97:32)"
Client version: 3.15.2 Error message code: P1012
👀 1
I also found this StackOverflow question by @Nurul 😄
😃 1
I also realised that this error started happening after I promoted a branch to production on PlanetScale.
👀 1
Confirmed that this error started appearing when I use a connection string to directly access a branch promoted to production on PlanetScale. But using the same connection string via Dataproxy works.
a
i’m getting this same error with mongodb, it doens’t work with
env("DATABASE_URL")
but when i put the actual aconnection string it works, not sure how to resolve..
oh wow turns out i had
DATABASE_URL
env var defined already on my local machine zshrc and it was for postgres
s
My lambda function doesn't do anything that changes the database. It just tried to query it which results in an error.
Schema changes are working as expected
n
Hmm, that’s strange. The fact that this happens only after promoting branch to production seems to have something to do with this.
Now the thing is my
DATABASE_URL
is present in my Lambda configuration and when I log it, it does even print it.
I think this has to do with the fact that env files aren’t bundled into generated prisma client any longer. (from this comment)
s
Hmm, but it's weird that it logs the database url when the lambda runs. But Prisma is still unable to connect.
n
Would it be possible for you to update to the latest prisma version i.e.
4.4.0
and checking if the issue still persists?