Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sentry CLI Plugin ENOENT error with npm ci --ignore-scripts #1085

Closed
PsyGik opened this issue Dec 7, 2021 · 2 comments · Fixed by getsentry/sentry-javascript#4311
Closed
Labels

Comments

@PsyGik
Copy link

PsyGik commented Dec 7, 2021

Environment

How do you use Sentry?
Sentry SaaS (sentry.io)

Which SDK and version?
e.g: JavaScript (latest @sentry/nextjs)

Steps to Reproduce

  1. Setup Sentry for Next.js project
  2. CI starts the build with npm ci --ignore-scripts
  3. Run npm build
  4. Sentry fails with the below error.
Run `npm audit` for details.
❯ npm run build

> try-sentry-nextjs@0.1.0 build
> next build

info  - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5
info  - Checking validity of types
info  - Creating an optimized production build
Failed to compile.

Sentry CLI Plugin: spawn /Users/ddd/Development/Reviews/try-sentry-nextjs-review/node_modules/@sentry/cli/sentry-cli ENOENT


> Build error occurred
Error: > Build failed because of webpack errors
    at /Users/ddd/Development/Reviews/try-sentry-nextjs-review/node_modules/next/dist/build/index.js:397:19
    at async Span.traceAsyncFn (/Users/ddd/Development/Reviews/try-sentry-nextjs-review/node_modules/next/dist/telemetry/trace/trace.js:60:20)
    at async Object.build [as default] (/Users/ddd/Development/Reviews/try-sentry-nextjs-review/node_modules/next/dist/build/index.js:77:25)

Expected Result

Sentry should not be executing stuff in CI environments.

Actual Result

Sentry executes stuff in CI environments.


Related: #915

@gerbyzation
Copy link

Running into this issue as well after bootstrapping a next project with @sentry/wizard

@lobsterkatie
Copy link
Member

Hi, @PsyGik. Sorry you're running into this.

I've left a comment on the issue you linked, about a potential long-term fix, but in the short term, I've added a check to make sure the sentry-cli binary exists before we try to use it.

lobsterkatie added a commit to getsentry/sentry-javascript that referenced this issue Dec 23, 2021
…ugin (#4311)

Our nextjs SDK uses `sentry-cli` (by way of `SentryWebpackPlugin` and `@sentry/cli`) to upload sourcemaps. Because binaries (like the `sentry-cli` executable) need to be compiled differently for different OSs and architectures, `@sentry/cli` uses a post-install script to download the correct one as part of its install process, rather than ship with all possible binaries at once.

Of course, this goes awry if the post-install script isn't run, which is exactly what happens when `@sentry/cli` is installed with the `--ignore-scripts` option. The resulting missing binary then causes errors which bubble up to and through our SDK to the nextjs build process, which promptly crashes.

This fixes that by checking to make sure they binary has been downloaded before enabling `SentryWebpackPlugin`.

Fixes getsentry/sentry-cli#1085.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants