I have a next.js app setup with prisma (v3.13) as the ORM. I am testing out bit.io for db hosting, and I am getting this error when trying to connect with the client. Everything works as intended when I use a local postgres db. I'm currently using a connection string that looks like the following:
DATABASE_URL="postgresql://[username]:[password]@db.bit.io/[username]/[dbname]"
I am trying to run prisma db push
and getting the following error
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "eli-front/rankstl", schema "public" at "db.bit.io:5432"
Error: P1000: Authentication failed against database server at `db.bit.io`, the provided database credentials for `(not available)` are not valid.
Please make sure to provide valid database credentials for the database server at `db.bit.io`.
I am assuming the core of the issue has to due with the part of the error that says credentials for '(not available)'
as if something isn't loading correctly.
Using the failing connection string with psql
works completely fine, but not with prisma.
There are two things that need to be done in order for bit.io to work with Prisma.
username.dbname
rather than username/dbname
. bit.io supports a number of different separator characters in the database name because different clients have different requirements around permissible characters in database names.CREATE DATABASE
, so a shadow database must be created explicitly. See the prisma docs for details.See the bit.io docs on connecting with Prisma for more details on setting up a minimum working connection.