Vercel build fails after passing linting checks, but it works locally

Hey @stefathanasoulias-99,

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:

  1. Vercel vs Local Environment Discrepancy

    1. Since your local builds are successful, let’s focus on Vercel-specific configurations.
    2. In your Vercel project settings, ensure the “Framework Preset” is correctly set to Next.js.
    3. Verify that your build command in Vercel matches your local setup, typically next build.
  2. Monorepo-specific Considerations

    1. Review your Turborepo configuration, especially the turbo.json file, to ensure it’s compatible with Vercel’s build process.
    2. Check that Vercel is correctly identifying and building the right workspace within your monorepo.
  3. Edge Runtime Compatibility

    1. The logs show issues with @clerk/nextjs using Node.js APIs incompatible with Edge Runtime.
    2. Consider updating to the latest version: npm install @clerk/nextjs@latest
    3. If problems persist, you might need to temporarily disable Edge Runtime for affected routes or explore Clerk’s Edge-compatible alternatives.
  4. WASM and Image Processing

    1. The warnings about libheif-js suggest potential issues with HEIC image conversion.
    2. Consider moving this processing server-side or exploring alternative libraries that are more compatible with Next.js 15 and Vercel’s environment.
  5. Dependency Management

    1. Given that you’ve moved shared dependencies to the root package.json, ensure Vercel is installing dependencies correctly in the monorepo context.
    2. You might need to adjust Vercel’s build settings to accommodate your monorepo structure.
  6. Incremental Testing

    1. 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.json file
  • 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!