By sumchans
I followed this tutorial https://www.digitalocean.com/community/tutorials/how-to-build-a-graphql-api-with-prisma-and-deploy-to-digitalocean-s-app-platform#:~:text=Resolver functions receive,in GraphQL Resolvers, was able to complete it with no issues. After completing it, I tried changing the database to the Supabase PostgresQL, since then I am having issues. I changed the env variable to the database url from the supabase and then I ran npx prisma migrate to sync the prisma schema. When I try the digital ocean api link I am not able to perform any queries. This is the error message I get - Please advise!
{
"errors": [
{
"message": "\nInvalid `prisma.post.create()` invocation:\n\n\n error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.\n --> schema.prisma:6\n | \n 5 | provider = \"postgresql\"\n 6 | url = env(\"DATABASE_URL\")\n | \n\nValidation Error Count: 1",
"locations": [
{
"line": 11,
"column": 3
}
],
"path": [
"createDraft"
],
"extensions": {
"code": "INTERNAL_SERVER_ERROR",
"exception": {
"clientVersion": "2.23.0",
"stacktrace": [
"Error: ",
"Invalid `prisma.post.create()` invocation:",
"",
"",
" error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`.",
" --> schema.prisma:6",
" | ",
" 5 | provider = \"postgresql\"",
" 6 | url = env(\"DATABASE_URL\")",
" | ",
"",
"Validation Error Count: 1",
" at cb (/workspace/node_modules/@prisma/client/runtime/index.js:35107:17)",
" at runMicrotasks (<anonymous>)",
" at processTicksAndRejections (internal/process/task_queues.js:97:5)"
]
}
}
}
],
"data": null
}
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hi there,
I think that you can not change the connector to supabase://
as it is not a valid connector according to the list with the supported database connectors for Prisma here:
https://www.prisma.io/docs/concepts/database-connectors/postgresql#connection-url
I think that you need to keep postgresql://
as the connector.
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.