prisma: Supabase: db error: ERROR: unexpected response from login query

Bug description

I am getting db error: ERROR: unexpected response from login query when try to use supabase as database. This only happens when accessing an external database, while testing with a local database under docker worked perfectly.

How to reproduce

  1. Go to Supabase
  2. Create or login account
  3. Create an project
  4. Go to Database > Connection Pooling
  5. Scroll to bottom and copy Connection string
  6. Replace DATABASE_URL in environment variable
  7. Run npx prisma migrate dev
  8. See error

Expected behavior

Prisma CLI executes the given commands without any error

Prisma information

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

model User {
  id   Int     @id @default(autoincrement())
  username String?
}

Environment & setup

// .env
DATABASE_URL="postgresql://XXXX:XXXX@XXX.supabase.co:6543/XXX?pbbouncer=true"

Prisma Version

prisma                  : 3.1.1
@prisma/client          : 3.1.1
Current platform        : debian-openssl-1.1.x
Query Engine (Node-API) : libquery-engine c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node)
Migration Engine        : migration-engine-cli c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine    : introspection-core c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary           : prisma-fmt c22652b7e418506fab23052d569b85d3aec4883f (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Default Engines Hash    : c22652b7e418506fab23052d569b85d3aec4883f
Studio                  : 0.423.0

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

Can you try the other connection string that Supabase gives you under Settings -> Database -> Connection String?

We know this is pretty confusing, but can’t really think of a way to nicely surface this information when you use Prisma with the wrong (pooled) connection string to run Prisma Migrate.

This helped me to resolve the issue! Many thanks!

Migration works on the port 5432, but doesn’t work on 6543

Hello! I also get this error!

image

I use the connection string from Settings > Database > Connection Pooling

I am not sure I follow. Are you saying that with the direct connection (and without adding pgbouncer=true to that connection string), you are also getting the same error?

Not same error, but migration progression failed due to supabase Timeout. I will attach screenshoot tonight

Can you try the other connection string that Supabase gives you under Settings -> Database -> Connection String?

We know this is pretty confusing, but can’t really think of a way to nicely surface this information when you use Prisma with the wrong (pooled) connection string to run Prisma Migrate.