-
-
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(nuxt): Improve serverless event flushing and scope isolation #14605
Conversation
size-limit report 📦
|
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.
Can we add an e2e test for the isolation scope testing?
|
||
async function flushWithTimeout(): Promise<void> { | ||
const sentryClient = getClient(); | ||
const isDebug = sentryClient ? sentryClient.getOptions().debug : false; |
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.
q: why aren't we using DEBUG_BUILD
here?
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.
Because this is in the runtime
folder of the Nuxt module and it's not possible to use it there because it's a different build context :(
// In environments where we cannot make use of OTel httpInstrumentation, e.g. when just importing the Sentry server config at | ||
// the top level instead of `--import` or dynamic import like on Vercel, we still need to ensure requests are properly isolated | ||
const isolationScope = getIsolationScope(); | ||
const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope; |
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.
maybe let's add a comment here that describes what/why we are doing here:
If otel instrumentation works, this will already be isolated at this point by the SentryHttpInstrumentation. We can identify this by comparing the current isolation scope to the default one. If that is the case, all good, we do not need to do anything. else, we fork the isolation scope here :)
const isolationScope = getIsolationScope(); | ||
const newIsolationScope = isolationScope === getDefaultIsolationScope() ? isolationScope.clone() : isolationScope; | ||
|
||
consoleSandbox(() => { |
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.
no strong feelings, but do we need to always log this, or is logger.log
not enough here? 🤔
e77d345
to
790f765
Compare
Adds serverless (e.g. Vercel, Netlify) improvements:
waitUntil
for waiting on Sentry events to send before shutting down the function