Error P1012 when trying to use Prisma Postgres

Hey there 👋 I'm trying to use Prisma Postgres, but I am getting this error. I am unsure why the DATABASE_URL provided by Prisma would not work? Mine follows the format: prisma+postgres://accelerate.prisma-data.net/?api_key=..." but I get the following error when running npx prisma migrate dev --name init
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`. To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy. Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `postgresql://` or `postgres://`. To use a URL with protocol `prisma://`, you need to either enable Accelerate or the Data Proxy. Enable Accelerate via `prisma generate --accelerate` or the Data Proxy via `prisma generate --data-proxy.
4 Replies
Nurul
Nurul•2w ago
Hello @Alaskan donut 👋 This is strange. Prisma Postgres should work as expected with Prisma Migrate. Can you double check that the correct environment variable - DATABASE_URL is being used. Do you have any other database connection strings in your env file?
Alaskan donut
Alaskan donutOP•2w ago
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=..."

PULSE_API_KEY="..."
DATABASE_URL="prisma+postgres://accelerate.prisma-data.net/?api_key=..."

PULSE_API_KEY="..."
These are the two keys Prisma Postgres provides me during setup. I have no other keys that might conflict.
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins", "typedSql", "omitApi"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins", "typedSql", "omitApi"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
Are there any resources on debugging this?
Nurul
Nurul•2w ago
Is your repository open source? If yes, can you share it with me? I'll try spinning up a new prisma postgres db and check if I get the same issue
Alaskan donut
Alaskan donutOP•2w ago
It is not, but if you shoot me your github email I can share it with you. Currently I am using Neon until I can resolve this.
Want results from more Discord servers?
Add your server