sentry-javascript: Vercel + Nextjs cannot find Sentry CLI binary
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
SDK Version
7.60.1
Framework Version
Next 13.4.12 and react 18.2.0
Link to Sentry event
No response
SDK Setup
No response
Steps to Reproduce
- Setup a simple monorepo with Turborepo
- Copy over this nextjs app https://github.com/vercel/next.js/tree/canary/examples/with-sentry
- Upload to vercel
Expected Result
Source maps are uploaded properly.
Actual Result
The sentry upload reports the following error: error - Sentry CLI binary not found. Source maps will not be uploaded.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 9
- Comments: 40 (14 by maintainers)
Yarn berry pnp solution
Write this in yarnrc.yaml
@sentry/nextjsuses loadModule() to import@sentry/webpack-plugin. but, loadMoudle() is in@sentry/utilsand@sentry/utilshas not@sentry/webpack-plugindependency.yarn berry pnp points out that this is ambiguous dependency.
(sorry bad english)
@bastiankistner Thank you for your concern. Trust me this is being looked at. I am also extremely annoyed by the persistence and frequency of this bug (because I have to keep explaining) and I keep bugging my manager to be able to allocate time to fix this.
@webjay Since you’re using bun you need to add
@sentry/clias a trusted dependency: https://bun.sh/guides/install/trustedI have a similar problem to @webjay but I dont have the webpack error message.
I’m switching an existing React project (custom webpack build) that used Sentry over to a next.js project (using default Next.js configs). I am an existing Sentry customer, and have done a number of integrations over the years, including with Nextjs.
I used the @sentry/wizard npx tool to set up my integration. I was able to see the example API error in the sentry UI.
When I start up my app, I get the “Can not find sentry CLI binary” message.
~I will try downgrading Next.js since i’m currently running the latest
14.0.1and perhaps that’s causing issues.~ Edit: I tried downgrading to the most recent Next 13 build, and the error was the same.My build works with
"next": "12.3.4", "@sentry/nextjs": "7.75.1"But not with
"next": "14.0.1", "@sentry/nextjs": "7.77.0":Thank you very much @iforst!! It seems that updating my Next.js SDK and removing
@Sentry/clisolved my problem!@saguilarolmo Hm that sucks. Just dumping a few things, please ignore if you already tried them:
@sentry/cliYep. So when you build your app, in the case you would upload source maps, the SDK just downloads the binary if it is not there and then continues the build.
Awesome, that works 🙌
@baptisteArno This workaround worked for us. Add a manual run of the cli install script as the first part of your buildCommand:
For any future googlers, this was our issue – we had been using
yarn install --immutable --mode=skip-buildin CI, and the skip-build mode prevented post-install scripts from running, which prevented the sentry-cli binary from being found.@Xhale1 Please check if the
sentry-clibinary is located in@sentry/cli/bin.In any case. Vercel caches builds and dependecies. Can you try rerunning a build without cache? There’s a checkbox in Vercel for that.