Thank you for providing such a detailed explanation of your situation. I appreciate the effort you’ve already put into troubleshooting.
I’d suggest digging deep on the following:
-
Vercel vs Local Environment Discrepancy
- Since your local builds are successful, let’s focus on Vercel-specific configurations.
- In your Vercel project settings, ensure the “Framework Preset” is correctly set to Next.js.
- Verify that your build command in Vercel matches your local setup, typically
next build.
-
Monorepo-specific Considerations
- Review your Turborepo configuration, especially the
turbo.jsonfile, to ensure it’s compatible with Vercel’s build process. - Check that Vercel is correctly identifying and building the right workspace within your monorepo.
- Review your Turborepo configuration, especially the
-
Edge Runtime Compatibility
- The logs show issues with
@clerk/nextjsusing Node.js APIs incompatible with Edge Runtime. - Consider updating to the latest version:
npm install @clerk/nextjs@latest - If problems persist, you might need to temporarily disable Edge Runtime for affected routes or explore Clerk’s Edge-compatible alternatives.
- The logs show issues with
-
WASM and Image Processing
- The warnings about
libheif-jssuggest potential issues with HEIC image conversion. - Consider moving this processing server-side or exploring alternative libraries that are more compatible with Next.js 15 and Vercel’s environment.
- The warnings about
-
Dependency Management
- Given that you’ve moved shared dependencies to the root
package.json, ensure Vercel is installing dependencies correctly in the monorepo context. - You might need to adjust Vercel’s build settings to accommodate your monorepo structure.
- Given that you’ve moved shared dependencies to the root
-
Incremental Testing
- Since the issue is specific to Vercel deployment, try deploying a minimal version of your app (maybe just the main page) and gradually add complexity to identify the breaking point.
Cross-posting this community post in case it’s helpful:
If you’re still facing issues after trying these steps, please share:
- Your updated
turbo.jsonfile - The latest Vercel build log after implementing these changes
- Any specific error messages you’re seeing in the Vercel deployment
Let us know how you get on!