Skip to content

[Bug]: prisma CLI commands require datasource URL even with adapter configuration in Prisma 6.16.0 #28072

@medz

Description

@medz

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

  1. 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 */);
  },
});
  1. Configure datasource in schema.prisma without URL (as was working in 6.15.0):
datasource db {
    provider = "sqlite"
}
  1. Try to run any Prisma CLI command:
npx prisma --version
npx prisma validate
npx prisma generate

Expected 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:

  1. The DATABASE_URL environment variable must exist (even if unused by the adapter)
  2. VS Code Prisma extension shows warnings about removing the adapter configuration
  3. 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:

  1. The new ESM-first prisma-client generator became GA
  2. Rust-free ORM with driver adapters became GA
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions