fix(prisma): make prisma generate work without DATABASE_URL (fixes Release build)#33
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The v0.3.0 Release workflow failed at
RUN npx prisma generatein the Docker build:prisma.config.tsused Prisma'senv('DATABASE_URL'), which v7 evaluates eagerly and throws on when unset. The image build runsprisma generate(no DB needed) without DATABASE_URL, so it failed. Regular CI passed only becauseci.ymlsets 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.jsonversion 0.1.0 → 0.3.0 (was stale).Verified locally:
prisma generatesucceeds with DATABASE_URL unset; schema validates with it set;next buildclean.