Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.7k
fix(cloudflare): Missing events inside waitUntil#18486
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:develop
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
github-actionsbot commentedDec 12, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
size-limit report 📦
|
github-actionsbot commentedDec 15, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
node-overhead report 🧳Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.
|
JPeer264 commentedDec 15, 2025
This PR is on hold for now, because we add another span in here and this might not be optimal in all situations. We'll try to use the span streaming implementation and see if we can use the same behavior as before, but send the |
follow up to#16681
Problem
The waitUntil could take longer than the actual request is taking, which is actually a good thing and wanted by Cloudflare. By definition of our implementation we are ending the root span at the end of the request, while the promise inside waitUntil could still generate events. These events are only send while the root span is still active ("Event 1" in the mermaid diagram), but are not send anymore when the root span ended ("Event 2") and are basically dropped.
Solution
There is a way to end the root span after everything has been finished, which allows us to send everything in one transaction. In order to still have a correct span for the request itself, I had to create a dedicated span just for the request (that can be seen in the "after" picture beneath).
Right now we only send one transaction after everything is finished, which could take up to "request time" + 30 seconds (that is the maximum wait time for a
waitUntil). Which means Sentry gets that data after that time. Very soon there will be the concept ofspan streaming which would make these events available earlier.Special eyes
There is now an extra span for the
fetch, which is basically the request itself. So this can be looked at with a critical eyeComparison
before:
after: