Hi Netlify Support,
Client’s site has recently started failing after deployment, despite successful builds and no direct changes to our build process, environment variables, or related configuration in our codebase.
Site name: fancy-moxie-bd04f5.netlify.app
Site ID: b7c892ac-6ea4-48f0-a423-5655772a4460
Problem: When accessing the site, a Next.js ISR handler error occurs with the message: Runtime.ImportModuleError: Error: Cannot find module 'styled-jsx/style'
The full error stack points to files within the Netlify function environment (/var/task/
…):
{“errorType”:“Runtime.ImportModuleError”,“errorMessage”:“Error: Cannot find module ‘styled-jsx/style’\nRequire stack:\n- /var/task/apps/skanstes-web/node_modules/next/dist/server/require-hook.js\n- /var/task/apps/skanstes-web/node_modules/next/dist/server/next-server.js\n- /var/task/apps/skanstes-web/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js\n- /var/task/___netlify-odb-handler.js\n- /var/runtime/index.mjs”,“stack”:[“Runtime.ImportModuleError: Error: Cannot find module ‘styled-jsx/style’”,“Require stack:”,“- /var/task/apps/skanstes-web/node_modules/next/dist/server/require-hook.js”,“- /var/task/apps/skanstes-web/node_modules/next/dist/server/next-server.js”,“- /var/task/apps/skanstes-web/.netlify/functions-internal/___netlify-odb-handler/___netlify-odb-handler.js”,“- /var/task/___netlify-odb-handler.js”,“- /var/runtime/index.mjs”," at _loadUserApp (file:///var/runtime/index.mjs:1087:17)“,” at async UserFunction.js.module.exports.load (file:///var/runtime/index.mjs:1119:21)“,” at async start (file:///var/runtime/index.mjs:1282:23)“,” at async file:///var/runtime/index.mjs:1288:1"]}
Netlify internal ID: 01JSSJD5P23JPJ5F7HGVTED2GD
Key Observations:
- Working Version: Deployments from approximately one week ago function correctly. The last known working deployment is locked and accessible here:
https://68074da0487ae40008740e0a--fancy-moxie-bd04f5.netlify.app/
- Deployment Summary Differences: I’ve noticed a discrepancy in the deployment summaries between working and failing builds. Specifically, the number of processed redirects and deployed functions differs (screenshot bellow; previously working version on the right).
Troubleshooting Attempted (No Success):
- Cleared cache and redeployed.
- Locked package versions using the lockfile from the last working build.
- Temporarily added
styled-jsx
as a direct dependency. - Tried specifying the legacy Next.js Runtime v4.41.3 in
netlify.toml
. - Executed the build command without using Turborepo (
turbo run build
).
Hypothesis: I suspect a potential change in the Netlify build environment, the underlying Next.js Runtime (@netlify/plugin-nextjs
), or their interaction might be causing this issue.
Request: Could you please assist in investigating why this issue occured? I need help understanding what changed and how to resolve this error. If you need more specific information, please let me know.
Thanks.