Skip to content

fix(prisma): make prisma generate work without DATABASE_URL (fixes Release build)#33

Merged
rumitvn merged 1 commit into
masterfrom
fix/prisma-config-generate
Jun 8, 2026
Merged

fix(prisma): make prisma generate work without DATABASE_URL (fixes Release build)#33
rumitvn merged 1 commit into
masterfrom
fix/prisma-config-generate

Conversation

@rumitvn

@rumitvn rumitvn commented Jun 8, 2026

Copy link
Copy Markdown
Owner

The v0.3.0 Release workflow failed at RUN npx prisma generate in the Docker build:

PrismaConfigEnvError: Cannot resolve environment variable: DATABASE_URL

prisma.config.ts used Prisma's env('DATABASE_URL'), which v7 evaluates eagerly and throws on when unset. The image build runs prisma generate (no DB needed) without DATABASE_URL, so it failed. Regular CI passed only because ci.yml sets DATABASE_URL.

Fix: attach the datasource only when DATABASE_URL is present (via process.env), so generate works during the image build while migrate/introspection still get the URL when set.

Also bumps package.json version 0.1.0 → 0.3.0 (was stale).

Verified locally: prisma generate succeeds with DATABASE_URL unset; schema validates with it set; next build clean.

…ersion to 0.3.0

The Prisma 7 `prisma.config.ts` used `env('DATABASE_URL')`, which Prisma 7
evaluates eagerly and throws on when the var is missing. The Docker image
build runs `npx prisma generate` (no DB needed) without DATABASE_URL set, so
the Release workflow failed at the generate step.

Attach the datasource only when DATABASE_URL is present (via process.env),
so generate works in the image build while migrate/introspection still get
the URL when it is set. Also bump package.json version to 0.3.0.
@rumitvn rumitvn merged commit 0358eb8 into master Jun 8, 2026
1 check passed
@rumitvn rumitvn deleted the fix/prisma-config-generate branch June 8, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants