Error validating datasource `db`: the URL must start with the protocol `file:`

error when I run prisma db pull:
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `file:`.
--> schema.prisma:10
|
9 | provider = "sqlite"
10 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]
Error: Prisma schema validation - (get-config wasm)
Error code: P1012
error: Error validating datasource `db`: the URL must start with the protocol `file:`.
--> schema.prisma:10
|
9 | provider = "sqlite"
10 | url = env("DATABASE_URL")
|

Validation Error Count: 1
[Context: getConfig]
I've seen people on github with the same issue and the solution was to change their .env file from DATABASE_UTL="LIKE_THIS" to DATABASE_URL=LIKE_THIS but I didnt use quotes in my .env in the first place. I also run prisma generate before running db pull any ideas whats wrong?
7 Replies
uiuxphil
uiuxphilOP•2y ago
also my schema file (initial, havent change it)
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

model Example {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

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

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

model Example {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
Sybatron
Sybatron•2y ago
Don't you need them in .env
uiuxphil
uiuxphilOP•2y ago
the quotes? yeah I dont use quotes
Sybatron
Sybatron•2y ago
GitHub
`Error: P1012 Introspection failed as your current Prisma schema fi...
This schema works: generator client { provider = "prisma-client-js" previewFeatures = ["referentialActions"] } datasource db { provider = "sqlite" url = "foo"...
Sybatron
Sybatron•2y ago
try to check how is the error caused and see if you have any of the issues there 🤔
uiuxphil
uiuxphilOP•2y ago
nope, my whitespaces are fine oh man I have no clue could be everything tbh Okay I found it! I just copied schema.prisma from my other project, but thats weird because I didnt manualy touched any of these files. only generated them via db pull
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
schemas = ["auth", "public"]
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["multiSchema"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
schemas = ["auth", "public"]
}
Want results from more Discord servers?
Add your server