bun
bun copied to clipboard
Get Sentry-like error reporting working
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
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 😅
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
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.
#7472 still seems to be an issue with:
- `@sentry/bun version 7.93.0`
- `bun version 1.0.20`
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.
^^ please fix
I agree with @GingerAdonis, this is very important for many devs. Do you guys have any estimates on when this could potentially be fixed?
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