sentry-javascript: `ERROR Cannot find module '@sentry/utils'` breaking Vercel deployments

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/sveltekit

SDK Version

7.98.0

Framework Version

7.98.0

Link to Sentry event

No response

SDK Setup

Sentry.init({
  dsn: PUBLIC_SENTRY_DSN,
  environment: appConfig.settings.reportingEnvironment,
  tracesSampleRate: appConfig.settings.sentrySamplingRate,
  // switching from CaptureConsole class to captureConsoleIntegration leads to breakage 
  integrations: [captureConsoleIntegration({ levels: ['warn', 'error', 'assert'] })],
  enabled: process.env.NODE_ENV === 'production',
})

Steps to Reproduce

We upgraded from 7.91.0 to 7.98.0 today and encountered breaking Vercel deployments:

2024-01-30T19:28:44.383Z	undefined	ERROR	Cannot find module '@sentry/utils'
Require stack:
- /var/task/node_modules/.pnpm/@sentry+integrations@7.98.0/node_modules/@sentry/integrations/cjs/captureconsole.js
- /var/task/node_modules/.pnpm/@sentry+integrations@7.98.0/node_modules/@sentry/integrations/cjs/index.js
2024-01-30T19:28:44.384Z	undefined	ERROR	Did you forget to add it to "dependencies" in `package.json`?
INIT_REPORT Init Duration: 476.37 ms	Phase: invoke	Status: error	Error Type: Runtime.ExitError
Error: Runtime exited with error: exit status 1

The stack trace clearly points to captureconsole.js which made it clear for me that switching from CaptureConsole class to captureConsoleIntegration led to the breakage.

Expected Result

Vercel deployments should work as normal

Actual Result

About this issue

  • Original URL
  • State: open
  • Created 5 months ago
  • Comments: 24 (10 by maintainers)

Most upvoted comments

We actually just got rid of Sentry and our builds work fine again with turbo cache enabled.

This issue is solved for us bu, butwould keep it open since there are other people affected from it.

I’m having the same issue too, using pnpm & turborepo. Manually installed @sentry/utils but it still randomly fails.

Manually redeploying from the Vercel dashboard seem to fix the deploy. But then next time deploying it randomly happens on one of the sites in the monorepo.

@mcmxcdev That honestly sounds like turborepo is misconfigured.

Our workaround for the time being was to disable turborepo cache which seems somehow related.

Now we have upgraded from 7.98.0 to 7.105.0 and still encounter this after re-enabling turbo cache.

I tried explicitly installing @sentry/utils as dependency, still erroring out. Blocks us completely from using turborepo cache for quicker builds, we might consider removing Sentry from our application.

@madeleineostoja Totally fair. I’d personally rather blame pnpm than Sentry here but your technical decisions are up to you.

I tested in Vercel myself with basic SvelteKit app and couldn’t reproduce, so going to close this for now, we’ll need a reproduction to dig in further.

If anyone else experiences this please reach out, we can re-open the issue and take a look. Thanks!