You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(netlify): forward event.waitUntil to the Netlify context - #5144
📖 Documentation (updates to the documentation, readme, or JSdoc annotations)
🐞 Bug fix (a non-breaking change that fixes an issue)
👌 Enhancement (improving an existing functionality like performance)
✨ New feature (a non-breaking change that adds functionality)
🧹 Chore (updates to the build process or auxiliary tools and libraries)
⚠️ Breaking change (fix or feature that would cause existing functionality to change)
📚 Description
On Netlify, event.waitUntil() registers nothing. Netlify passes context.waitUntil to Functions and Edge Functions, but the netlify entry ignores its second argument and netlify-edge doesn't set req.waitUntil.
This PR sets req.waitUntil from the Netlify context in both entries, the same way the Cloudflare and Vercel entries do. The two new tests in test/presets/netlify.test.ts call the built handlers with a waitUntil spy. They fail on main and pass here. The edge test runs on Deno, like the existing one.
No actionable comments were generated in the recent review.
Walkthrough
The Netlify server and edge handlers now forward context.waitUntil to the request when req.waitUntil is unset. Tests cover the forwarding behavior for both handlers.
Changes: Netlify waitUntil forwarding
Layer / File(s)
Summary
Forward context waitUntil to requests src/presets/netlify/runtime/netlify.ts, src/presets/netlify/runtime/netlify-edge.ts, test/presets/netlify.test.ts
Both handlers assign the bound context.waitUntil method only when req.waitUntil is unset. Tests verify the server handler passes a Promise to the callback and the edge handler invokes its callback once.
This change forwards waitUntil to the Netlify context so background work registered with event.waitUntil is honored. No merge-blocking risk remains.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title follows the conventional commits format with the type "fix" and the scope "netlify". It describes the main change: the Netlify entries now forward event.waitUntil to the Netlify context. The…
Description check
The description links issue #5143, marks the change as a bug fix, and explains that the netlify and netlify-edge entries ignore the Netlify context waitUntil. It also describes the two new tests. This…
Linked Issues check
Issue #5143 requires forwarding Netlify's context.waitUntil to the request in both the netlify and netlify-edge entries. The diff at head sets req.waitUntil in both entries. In `src/presets/ne…
Out of Scope Changes check
The whole-PR diff against merge base 749b12b touches only src/presets/netlify/runtime/netlify.ts, src/presets/netlify/runtime/netlify-edge.ts, and test/presets/netlify.test.ts. The netlify.ts …
Full details: Title check
Explanation
The title follows the conventional commits format with the type "fix" and the scope "netlify". It describes the main change: the Netlify entries now forward event.waitUntil to the Netlify context. The title matches the changeset and the linked issue.
Full details: Description check
Explanation
The description links issue #5143, marks the change as a bug fix, and explains that the netlify and netlify-edge entries ignore the Netlify context waitUntil. It also describes the two new tests. This matches the changeset.
Full details: Linked Issues check
Explanation
Issue #5143 requires forwarding Netlify's context.waitUntil to the request in both the netlify and netlify-edge entries. The diff at head sets req.waitUntil in both entries. In src/presets/netlify/runtime/netlify.ts, the handler now accepts context?: Context and sets req.waitUntil ??= context?.waitUntil?.bind(context). In src/presets/netlify/runtime/netlify-edge.ts, it sets req.waitUntil ??= context.waitUntil?.bind(context). This matches the Cloudflare and Vercel pattern named in the issue. The PR adds Node and Deno tests in test/presets/netlify.test.ts that call the built handlers with a waitUntil spy. The test file was not read directly; this result relies on the PR summary for the test content. The coding requirement is met by the source changes.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against merge base 749b12b touches only src/presets/netlify/runtime/netlify.ts, src/presets/netlify/runtime/netlify-edge.ts, and test/presets/netlify.test.ts. The netlify.ts change also adds a type-only import of Context from @netlify/functions, which supports the new parameter. All changes serve the objective of forwarding waitUntil in the two Netlify entries. No unrelated change was found.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: bfccd3a0-210f-4489-91f4-f18fbbfb81c9
Commits
Reviewing files that changed from the base of the PR and between 749b12b and 02c11ed.
Files selected for processing: 3
src/presets/netlify/runtime/netlify-edge.ts
src/presets/netlify/runtime/netlify.ts
test/presets/netlify.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
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
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.
🔗 Linked issue
resolves #5143
❓ Type of change
📚 Description
On Netlify,
event.waitUntil()registers nothing. Netlify passescontext.waitUntilto Functions and Edge Functions, but thenetlifyentry ignores its second argument andnetlify-edgedoesn't setreq.waitUntil.This PR sets
req.waitUntilfrom the Netlify context in both entries, the same way the Cloudflare and Vercel entries do. The two new tests intest/presets/netlify.test.tscall the built handlers with awaitUntilspy. They fail onmainand pass here. The edge test runs on Deno, like the existing one.📝 Checklist