fix(server): generate Prisma Client on Vercel build (production hotfix)#86
Merged
Conversation
Vercel caches deps so Prisma's auto-generate never runs, leaving an outdated client that throws PrismaClientInitializationError at cold start. Add a postinstall hook + prisma generate in the build. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
Production
api-shopflowcrashes at cold start withPrismaClientInitializationError: Vercel caches dependencies, so Prisma's auto-generate never runs and the deployed Prisma Client is outdated. Every route (incl./api/health) returns500 FUNCTION_INVOCATION_FAILED, which the browser surfaces as a CORS error on the frontend.Fix
postinstall: prisma generate— regenerates the client on Vercel's install step.build: prisma generate && tsc— belt-and-suspenders for build-based flows.Ref: https://pris.ly/d/vercel-build
Test plan
curl https://api-shopflow.vercel.app/api/healthreturns 200.🤖 Generated with Claude Code