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
fix(node): Use unique variable for ANR context transfer #11161
Conversation
size-limit report 📦
|
'const ctx = __SENTRY__.acs?.getCurrentScope().getPropagationContext() || {}; ctx.traceId + "-" + ctx.spanId + "-" + ctx.parentSpanId', | ||
'const __sentry_ctx = __SENTRY__.acs?.getCurrentScope().getPropagationContext() || {}; __sentry_ctx.traceId + "-" + __sentry_ctx.spanId + "-" + __sentry_ctx.parentSpanId', | ||
// Don't re-trigger the debugger if this causes an error |
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.
Whatever context this is evaluated in, the next time the same Runtime.evaluate is used (assuming support for multiple ANR captures is added), won't this potentially just lead to the same conflicting variable issue due to it now being defined from the last time Runtime.evaluate defined it? Here was my solution:
const t = Date.now()
// Evaluate a script in the currently paused context
session.post('Runtime.evaluate', {
// Grab the trace context from the current scope
expression: `const ctx_${t} = __SENTRY__.acs?.getCurrentScope().getPropagationContext() || {}; ctx_${t}.traceId + "-" + ctx_${t}.spanId + "-" + ctx_${t}.parentSpanId`,
// Don't re-trigger the debugger if this causes an error
silent: true,
}, (err, param) => {
Just using var
instead of const
with your __sentry_ctx
would also work?
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.
Yep good point!
Closes #11147