You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bun instrumentation stops working if reload is called on the server #15144
Sentry.init({tracesSampleRate: 1.0,environment: "some_env",});// server before reloading is instrumentedconstserver=Bun.serve({asyncfetch(_req){thrownewError("I should have instrumentation, and I do");},port: 3000,});// server after reloading is not instrumentedserver.reload({asyncfetch(_req){thrownewError("I should have instrumentation, but I don't");},})awaitfetch('http://localhost:3000/');
Steps to Reproduce
Create a Bun server
Reload the server
Throw an error in the handler and look at the Sentry error
Reloading is done out of the box by some frameworks built on top of Bun Serve, like ElysiaJS (which does it after AOT / precompilation is completed).
Expected Result
The error should have instrumentation, such as request URL, request headers, browser information and trace information:
Hey @nathankleyn thanks for reporting this! I see you're already working on a fix for this? I had a quick look at the commit and it looks good to me. Are you interested in opening a PR once it's ready?
Hey @Lms24 — thanks so much for your superfast reply! I've raised the PR now at #15148 (review), although I hit a bit of a problem when I discovered the tests for the @sentry/bun basically all were not actually working in practice (silently nothing was being tested due to how the tests were structured).
I've reworked the tests a bit and raised a working version but I will definitely need a small amount of assistance to solve one last remaining problem with test isolation before it can be merged.
Activity
Ensure instrumentation of Bun.serve survives a server reload
Lms24 commentedon Jan 23, 2025
Hey @nathankleyn thanks for reporting this! I see you're already working on a fix for this? I had a quick look at the commit and it looks good to me. Are you interested in opening a PR once it's ready?
Ensure instrumentation of Bun.serve survives a server reload
nathankleyn commentedon Jan 23, 2025
Hey @Lms24 — thanks so much for your superfast reply! I've raised the PR now at #15148 (review), although I hit a bit of a problem when I discovered the tests for the
@sentry/bunbasically all were not actually working in practice (silently nothing was being tested due to how the tests were structured).I've reworked the tests a bit and raised a working version but I will definitely need a small amount of assistance to solve one last remaining problem with test isolation before it can be merged.
Thanks in advance!
Ensure instrumentation of Bun.serve survives a server reload
Ensure instrumentation of Bun.serve survives a server reload
Lms24 commentedon Jan 24, 2025
Awesome, thanks a lot @nathankleyn! I see @AbhiPrasad is already taking a look, so we should get this merged in soon.