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 not working with @sentry/vite-plugin when installed with bun #412

Closed
3 tasks done
shapeshifta78 opened this issue Sep 25, 2023 · 10 comments
Closed
3 tasks done

Comments

@shapeshifta78
Copy link

shapeshifta78 commented Sep 25, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/browser

SDK Version

7.57.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

Sentry.onLoad(() => {
  Sentry.init({
    enabled: import.meta.env.PROD,
    dsn,
    release,
  
  });
});

Steps to Reproduce

Install @sentry-cli and @sentry/vite-plugin with bun and try to run it. Works fine when installed with npm ci, but does not work with bun.

Expected Result

Sourcemaps get generated and uploaded to sentry.

Actual Result

Error: spawn /Users/xxx/Projects/xxx/node_modules/@sentry/cli/sentry-cli ENOENT

@AbhiPrasad
Copy link
Member

I suspect what might be happening here is that Bun does not run postinstall by default, you have to add @sentry/cli to trusted dependencies. See: https://bun.sh/docs/cli/install#trusted-dependencies

If you do that, does it work?

@shapeshifta78
Copy link
Author

shapeshifta78 commented Sep 26, 2023

Good point, wasn't aware of that. Unfortunately it still does not work with the same error.
I added this to package.json
"trustedDependencies": ["@sentry/cli", "@sentry/vite-plugin"],

But I also guess it is the postinstall script or something...

@AbhiPrasad
Copy link
Member

Going to move this to the bundler plugin repo so we can investigate and look at this deeper. What version of bun are you using to run the command?

@AbhiPrasad AbhiPrasad transferred this issue from getsentry/sentry-javascript Sep 26, 2023
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 26, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Sep 28, 2023
@crax0
Copy link

crax0 commented Sep 28, 2023

Same problem for me with nextjs. First saw a problem with vercel "error - Sentry CLI binary not found. Source maps will not be uploaded." This lead me to add it as trustedDependencies to run post install scripts but its not working.
"trustedDependencies": ["@sentry/nextjs", "@sentry/cli"],

Current Bun version: 1.0.3

@Lms24
Copy link
Member

Lms24 commented Oct 3, 2023

Hmm I'm wondering if trustedDependencies only applies to direct dependencies but not to transitive ones?

@shapeshifta78
Copy link
Author

Gave this a retry and now it's working. Not sure what I did different the last time or if it's maybe related to updating bun.

Using trustedDependencies works, here are the steps: oven-sh/bun#2998 (comment)

@Cluster2a
Copy link

I am still getting the problem with svelteKit 1.27.6 / vite 4.5 + @sentry/sveltekit.
Adding the dependencies to trustedDependencies does not seem to work.

@lforst
Copy link
Member

lforst commented Nov 27, 2023

@Cluster2a you need to add @sentry/cli to the trusted dependencies

@Cluster2a
Copy link

Cluster2a commented Nov 27, 2023

@Cluster2a you need to add @sentry/cli to the trusted dependencies

I added all of them.
"trustedDependencies": ["@sentry/cli", "@sentry/vite-plugin", "@sentry/sveltekit"],

Error: spawn /node_modules/@sentry/cli/sentry-cli ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn /node_modules/@sentry/cli/sentry-cli',
  path: '/node_modules/@sentry/cli/sentry-cli',
  spawnargs: [ 'releases', 'propose-version' ],
  cmd: '/node_modules/@sentry/cli/sentry-cli releases propose-version'
}

Node.js v21.2.0
error: script "build" exited with code 1 (SIGHUP)

@lforst
Copy link
Member

lforst commented Nov 27, 2023

@Cluster2a I recommend just making sure @sentry/cli's install script runs before you use the CLI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

7 participants