Skip to content

"prisma generate" required database url #28708

Closed

Description

@Lure5134

Bug description

With the following prisma.config.ts file:

import 'dotenv/config'
import { defineConfig, env } from 'prisma/config'

export default defineConfig({
    schema: 'prisma/schema.prisma',
    migrations: {
        path: 'prisma/migrations',
    },
    datasource: {
        url: env('DATABASE_URL'),
    },
})

The command npx prisma generate failes with v7 with the error message that no DATABASE_URL is set.
In v6 the command works even when there is no database url provided.
This is required when generating the client in the Dockerfile and the database url is only provided when running the docker image. (and not compiling it)

Expected vs. Actual Behavior

The generation of the client should work even if no database url is provided.

Frequency

Consistently reproducible

Does this occur in development or production?

Both development and production

Is this a regression?

Yes, in Prisma v6 this works.

Workaround

Setting ENV DATABASE_URL=ignore in the Dockerfile before generating the client fixes the issue.
When running the image and setting the correct DATABASE_URL the correct connection is used.

Prisma Version

Prisma schema loaded from prisma/schema.prisma
prisma               : 7.0.0
@prisma/client       : 7.0.0
Operating System     : darwin
Architecture         : arm64
Node.js              : v22.13.0
TypeScript           : 5.9.3
Query Compiler       : enabled
PSL                  : @prisma/prisma-schema-wasm 6.20.0-16.next-0c19ccc313cf9911a90d99d2ac2eb0280c76c513
Schema Engine        : schema-engine-cli 0c19ccc313cf9911a90d99d2ac2eb0280c76c513 (at node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/schema-engine-darwin-arm64)
Default Engines Hash : 0c19ccc313cf9911a90d99d2ac2eb0280c76c513
Studio               : 0.8.0

Activity

  1. added
    kind/bug
    on Nov 25, 2025
  2. Lure5134 commented on Nov 25, 2025

    @Lure5134
    Author

    Duplicate: #28590

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions