sentry-javascript icon indicating copy to clipboard operation
sentry-javascript copied to clipboard

Bun: Crash when using `nodeProfilingIntegration()` integration

Open rehatkathuria opened this issue 2 years ago • 9 comments

Is there an existing issue for this?

  • [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
  • [x] I have reviewed the documentation https://docs.sentry.io/
  • [x] 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?

@sentry/browser

SDK Version

"@sentry/node": "^8.27.0", "@sentry/profiling-node": "^8.28.0", "@sentry/types": "^8.28.0",

Framework Version

No response

Link to Sentry event

No response

Reproduction Example/SDK Setup

import * as Sentry from "@sentry/node";
import { nodeProfilingIntegration } from "@sentry/profiling-node";

Sentry.init({
  dsn: process.env.SENTRY_DSN,
  environment: process.env.NODE_ENV,
  integrations: [nodeProfilingIntegration()], /// This line causes a crash on runtime. Removing it makes the runtime crash go away.
  profilesSampleRate: 1.0,
});

export default Sentry;

Steps to Reproduce

rehat@Mac -> bun start                               hock-server -> main ! |• $
$ bun run index.ts
dyld[99949]: missing symbol called
error: script "start" was terminated by signal SIGABRT (Abort)
[1]    99948 abort      bun start
rehat@Mac 134 ->                                     hock-server -> main ! |• $

Expected Result

rehat@Mac -> bun start                               hock-server -> main ! |• $
$ bun run index.ts
Listening on ...

Actual Result

Runtime crash

rehatkathuria avatar Sep 03 '24 20:09 rehatkathuria

Hello, thanks for writing :) Just to make sure you use the same version across all installed packages: Can you check the version in your lock file? Or try installing the same version (it should work with the ^, but just to get this factor out of the way). Do you still have this issue?

s1gr1d avatar Sep 04 '24 07:09 s1gr1d

@s1gr1d

    "@sentry/node": "^8.28.0",
    "@sentry/profiling-node": "^8.28.0",
    "@sentry/types": "^8.28.0",

These are my Sentry declarations inside package.json – I'm still seeing it with this

rehatkathuria avatar Sep 04 '24 13:09 rehatkathuria

Hi @rehatkathuria could you provide a minimal reproduction for this problem? I don't think this happens in every node app as we have e2e tests for profiling.

I'm gonna tag @JonasBa - any idea on top of your head?

Lms24 avatar Sep 05 '24 08:09 Lms24

@rehatkathuria Using Bun is unfortunately not supported and will cause crashes as v8 libraries we rely on are not available in Bun. Not that Bun is built on top of JSC, which means we would need an entirely different implementation of the profiler in order to be able to be able to profile the bun runtime. So far we just haven't had a strong need to build that, iirc you are the first one seeing this. If that is something you would like to see land, please feel free to open a separate issue (or I can open one) that we can use as an umbrella issue for future requests.

JonasBa avatar Sep 09 '24 16:09 JonasBa

Got it, thank you for the investigation and reply @JonasBa!

rehatkathuria avatar Sep 10 '24 00:09 rehatkathuria

@JonasBa - Will Bun be supported in nodeProfilingIntegration, or is there no plan to work on its support? I’m encountering the same error as described above.

SVITY avatar Mar 04 '25 12:03 SVITY

@SVITY Right now there is no plan to work on supporting bun, so you will see the same error as above. We unfortunately haven't received enough interest to be able to invest in this (it requires us to basically write a new profiler from the groundup), but if that changes, this is something we can revisit.

JonasBa avatar Mar 04 '25 13:03 JonasBa

The same question:) Bun is becoming more and more popular, and many of our projects are now running on Bun. Do you have any plans to support Bun in the profiler in the future?

w602350769 avatar Mar 10 '26 06:03 w602350769

Hello and thanks for writing in.

I created an issue to upvote for this feature so we can prioritize this:

  • https://github.com/getsentry/sentry-javascript/issues/19726

s1gr1d avatar Mar 10 '26 08:03 s1gr1d