prisma 6.7.0 working in production
prisma 6.7.0 only work in development but not in production after deploy to netlify
1 Reply
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
If Prisma 6.7.0 works in development but not in production after deploying to Netlify, the most common cause is that Prisma Client is not being (re)generated during the Netlify build due to dependency caching. Netlify caches node_modules between builds, so the prisma generate step (which is usually triggered by a postinstall script) may not run, resulting in an outdated or missing Prisma Client in production.
Solution:
You must explicitly run prisma generate during every Netlify build. There are several ways to do this: 1. Add a postinstall script to your package.json: This ensures Prisma Client is generated even when dependencies are cached and npm install is skipped by Netlify. This is the recommended universal solution Netlify build dependency caching workaround. 2. Alternatively, prepend prisma generate to your build script: 3. Or, add prisma generate to the build command in Netlify’s UI. Other considerations: - Make sure your schema.prisma’s binaryTargets includes the correct target for Netlify’s runtime (e.g., "rhel-openssl-1.0.x" or "rhel-openssl-3.0.x" depending on Node version) Deploy to Netlify. - Ensure your DATABASE_URL is set correctly in Netlify’s environment variables. Summary:
This is a known issue with Netlify’s dependency caching and is not specific to Prisma 6.7.0. Explicitly running prisma generate during the build resolves it. If you still encounter issues, check for errors related to missing environment variables or binary targets. If you need more details or step-by-step instructions, see the official Prisma docs: Netlify build de pendency caching workaround.
You must explicitly run prisma generate during every Netlify build. There are several ways to do this: 1. Add a postinstall script to your package.json: This ensures Prisma Client is generated even when dependencies are cached and npm install is skipped by Netlify. This is the recommended universal solution Netlify build dependency caching workaround. 2. Alternatively, prepend prisma generate to your build script: 3. Or, add prisma generate to the build command in Netlify’s UI. Other considerations: - Make sure your schema.prisma’s binaryTargets includes the correct target for Netlify’s runtime (e.g., "rhel-openssl-1.0.x" or "rhel-openssl-3.0.x" depending on Node version) Deploy to Netlify. - Ensure your DATABASE_URL is set correctly in Netlify’s environment variables. Summary:
This is a known issue with Netlify’s dependency caching and is not specific to Prisma 6.7.0. Explicitly running prisma generate during the build resolves it. If you still encounter issues, check for errors related to missing environment variables or binary targets. If you need more details or step-by-step instructions, see the official Prisma docs: Netlify build de pendency caching workaround.