Implement official Prisma solution for client generation
Following Prisma's official documentation for deployment caching issues: https://www.prisma.io/docs/orm/more/help-and-troubleshooting/vercel-caching-issue Changes: - Add 'prisma generate' to build script (official Prisma recommendation) - Add postinstall script for automatic client generation - Remove custom stub generator workaround - Keep runtime Prisma client generation in entrypoint.sh for reliability - Add openssl to runtime container (required for Prisma engines) This follows Prisma best practices: explicitly run prisma generate during the build process to ensure Prisma Client is always up-to-date. The entrypoint script regenerates the client at runtime to guarantee engine availability in the production environment.
This commit is contained in:
@@ -18,6 +18,16 @@ gosu nextjs sh -c '
|
||||
# Set npm cache to writable directory
|
||||
export NPM_CONFIG_CACHE=/tmp/.npm
|
||||
|
||||
# Generate real Prisma client at runtime (replaces build-time stub)
|
||||
echo "Generating Prisma client..."
|
||||
npx prisma generate || {
|
||||
echo "Warning: Prisma generate failed, attempting with checksum ignore..."
|
||||
PRISMA_ENGINES_CHECKSUM_IGNORE_MISSING=1 npx prisma generate || {
|
||||
echo "Error: Failed to generate Prisma client"
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
if [ ! -f "$DB_PATH" ]; then
|
||||
echo "Database not found, initializing..."
|
||||
npx prisma db push --skip-generate
|
||||
|
||||
Reference in New Issue
Block a user