-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Bug]: prisma CLI commands require datasource URL even with adapter configuration in Prisma 6.16.0 #28072
Description
Bug description
After upgrading from Prisma 6.15.0 to 6.16.0, all Prisma CLI commands now require a datasource URL to be configured and present in environment variables, even when using driver adapters with experimental: { adapter: true } in prisma.config.ts.
How to reproduce
- Configure Prisma with a driver adapter in
prisma.config.ts:
import { PrismaD1 } from "@prisma/adapter-d1";
import { defineConfig } from "prisma/config";
export default defineConfig({
experimental: { adapter: true },
schema: "prisma/schema.prisma",
async adapter() {
// adapter configuration
return new PrismaD1(/* config */);
},
});- Configure datasource in schema.prisma without URL (as was working in 6.15.0):
datasource db {
provider = "sqlite"
}- Try to run any Prisma CLI command:
npx prisma --version
npx prisma validate
npx prisma generateExpected behavior
In Prisma 6.15.0, when using driver adapters with experimental: { adapter: true }, Prisma CLI commands worked without requiring url = env("DATABASE_URL") in the datasource configuration, because the actual database connection was handled by the adapter.
Actual behavior
In Prisma 6.16.0, all CLI commands fail with:
Error: Environment variable not found: DATABASE_URL.
--> prisma/schema.prisma:11
|
10 | provider = "sqlite"
11 | url = env("DATABASE_URL")
|
Validation Error Count: 1
Workaround
Adding url = env("DATABASE_URL") to the datasource configuration works, but then:
- The
DATABASE_URLenvironment variable must exist (even if unused by the adapter) - VS Code Prisma extension shows warnings about removing the adapter configuration
- This creates confusion about whether the datasource URL or adapter is being used
Environment & setup
- OS: macOS
- Database: Cloudflare D1 (SQLite with @prisma/adapter-d1)
- Node.js version: Latest
- Prisma version: 6.16.0
Prisma information
schema.prisma:
generator client {
provider = "prisma-client"
output = "../generated/prisma"
engineType = "client"
runtime = "workerd"
moduleFormat = "esm"
}
datasource db {
provider = "sqlite"
url = env("DATABASE_URL") // This is now required but unused with adapter
}prisma.config.ts:
import { PrismaD1 } from "@prisma/adapter-d1";
import { defineConfig } from "prisma/config";
export default defineConfig({
experimental: { adapter: true, studio: true },
schema: "prisma/schema.prisma",
async adapter() {
// Environment validation and adapter setup
return new PrismaD1(envData);
},
});Additional context
This seems to be related to the changes in 6.16.0 where:
- The new ESM-first
prisma-clientgenerator became GA - Rust-free ORM with driver adapters became GA
- Schema validation became more strict
The issue creates a confusing developer experience where:
- The datasource URL is required for CLI validation but unused at runtime
- Environment variables must be present even for basic commands like
--version - The adapter configuration appears redundant when datasource URL is present