bun icon indicating copy to clipboard operation
bun copied to clipboard

Get Sentry-like error reporting working

Open Jarred-Sumner opened this issue 2 years ago • 7 comments

https://nodejs.org/api/process.html#event-uncaughtexceptionmonitor

  • [ ] process.on("unhandledRejection", cb)
  • [ ] process.on("unhandledException", cb)
  • [ ] process.on("uncaughtExceptionMonitor", cb)
  • [ ] process.setUncaughtExceptionCaptureCallback(cb)

This lets Sentry get error reporting working.

Ideally, the fix would go here:

https://github.com/oven-sh/bun/blob/7ce7f08a87079ff4827fc633f8c2d1a46c768633/src/bun.js/javascript.zig#L629-L640

We would add an unhandled rejection scope for either rejections or exceptions and have some way to distinguish between the two. This one would call into JS potentially for multiple handlers. The part that gets a little tricky is in unit tests where we rely on this behavior for expect().toThrow()

cc @dcramer

Jarred-Sumner avatar Sep 12 '23 12:09 Jarred-Sumner

We will release the Sentry SDK this week - Most things work (manually) once this lands we'll shoot out an update supporting it. Few users already asked for Sentry Bun SDK 😅

HazAT avatar Sep 18 '23 13:09 HazAT

We just shipped https://www.npmjs.com/package/@sentry/bun as part of https://github.com/getsentry/sentry-javascript/releases/tag/7.70.0.

bun add @sentry/bun

AbhiPrasad avatar Sep 20 '23 12:09 AbhiPrasad

I don't want to spam here 😅 but with version 7.71.0 of the Sentry Bun SDK we wrap Bun.serve automatically https://github.com/getsentry/sentry-javascript/pull/9080 capturing Errors and Transactions that happen during requests.

HazAT avatar Sep 26 '23 18:09 HazAT

#7472 still seems to be an issue with:

- `@sentry/bun version 7.93.0`
- `bun version 1.0.20`

colindotfun avatar Jan 15 '24 15:01 colindotfun

I'm aware that the team has lots of things to work on, but I'd like to say that this is likely a blocker for many to use Bun in production.

GingerAdonis avatar Feb 22 '24 09:02 GingerAdonis

^^ please fix

ohbob avatar Feb 23 '24 10:02 ohbob

I agree with @GingerAdonis, this is very important for many devs. Do you guys have any estimates on when this could potentially be fixed?

thecrabcode avatar Feb 26 '24 09:02 thecrabcode

In latest 7.x and 8.x versions of @sentry/bun we’ve added instrumentation to these global handlers to automatically capture errors and send them to Sentry. 8.0.0 also has a fix for performance monkey-patching, which means sentry performance monitoring should work in all cases with Bun!

Please reach out if something looks off, thanks for all the patience everyone!

https://docs.sentry.io/platforms/javascript/guides/bun

https://docs.sentry.io/platforms/javascript/guides/bun/migration/v7-to-v8

AbhiPrasad avatar May 15 '24 13:05 AbhiPrasad