Question

Not able to perform graphql queries after changing database to Supabase PostgresQL database

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
}


Submit an answer


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!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Bobby Iliev
Site Moderator
Site Moderator badge
May 23, 2021
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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.