Conversation
Contributor
size-limit report 📦
|
sergical
marked this pull request as ready for review
September 30, 2026 18:32
On Vercel, a function can be suspended as soon as it sends the response, so buffered telemetry arrives late or never. When a response finishes, keep the function alive with `waitUntil` until the response closes and the request's root span ends (2 s max), then flush. Closes #24909 Co-authored-by: Claude <claude@anthropic.com>
sergical
force-pushed
the
fix/vercel-node-waituntil-span-flush
branch
from
October 1, 2026 19:27
05da2d0 to
50ac024
Compare
sergical
requested review from
isaacs and
mydea
and removed request for
a team
October 1, 2026 19:27
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 50ac024. Configure here.
3 tasks done
- Wait at most 2 seconds for both the response to close and the root span to end, so a response that never emits `close` cannot hold the function open. - Unref the timer and type the request-context global the same way `vercelWaitUntil` does. - Bun does not publish `http.server.response.finish`, so the keep-alive suite is Node-only. Co-authored-by: Claude <claude@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

On Vercel, a function can be suspended as soon as it sends the response. Telemetry that is still buffered (spans, logs, metrics, errors) then arrives late or never.
When a response finishes,
@sentry/nodenow useswaitUntilto keep the function alive. It waits until the response closes and the request's root span ends (2 s max), then flushes. It works with or without tracing.Some frameworks end the root span shortly after the response closes, so the flush waits for it.
Tested with unit tests and an integration test that fails without the change, and confirmed on a Vercel deployment.
Closes #24909. Refs #23087.
Created with Claude Code