-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat(browser): Add setBrowserErrorFrameAsyncContextStrategy
#7807
Conversation
Oh nice! Should we remove the Could you export a version of The other strategies are still missing this too but I think we should add some tests that tests it all works with async/await. |
return { | ||
[fnName]: (cb: (hub: Hub) => T) => { | ||
hubs.set(hubId, newHub); | ||
return cb(newHub); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hubs
will grow in size indefinitely. You need to remove the entry after the callback is called and also in the case of error.
Damn, how many legacy ideas have I left behind!? So glad you found it! :D |
Hmm for some reason this stops working when I do something like so:
Possibly the promise is causing the error to get lost? |
Quite possibly. What does the stack look like at every context level? |
Doing something like so:
Gets me:
|
I guess the only way around this is to monkey patch patch promises themselves 😬 |
I think this is a consequence of |
Yup, it's because of https://v8.dev/blog/fast-async#improved-developer-experience |
Closing this because it not working with Maybe one day. |
ref: #7691
Based on @kamilogorek's excellent work in https://github.com/getsentry/sentry-js-tracing/blob/master/src/tracer-vanilla.ts, we add a async context strategy for the browser.
This means that we can get hub isolation in the browser as well - as long as people wrap stuff with
runWithAsyncContext
.@timfish curious to get your thoughts on this.