Skip to content

feat: adds waitUntil support for edge environments#39

Merged
HugoRCD merged 1 commit intomainfrom
feat/wait-until
Feb 4, 2026
Merged

feat: adds waitUntil support for edge environments#39
HugoRCD merged 1 commit intomainfrom
feat/wait-until

Conversation

@HugoRCD
Copy link
Copy Markdown
Owner

@HugoRCD HugoRCD commented Feb 4, 2026

This pull request adds robust support for serverless environments (Cloudflare Workers and Vercel Edge) by ensuring that log drain operations are completed before the runtime terminates. This is achieved by detecting and utilizing the waitUntil() API provided by these platforms. The changes also include comprehensive tests to verify this behavior and update the documentation to highlight the new feature.

@HugoRCD HugoRCD self-assigned this Feb 4, 2026
@HugoRCD HugoRCD requested a review from Copilot February 4, 2026 21:40
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
evlog-docs Ready Ready Preview, Comment Feb 4, 2026 9:40pm

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 4, 2026

Thank you for following the naming conventions! 🙏

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 4, 2026

npm i https://pkg.pr.new/evlog@39

commit: 7469b66

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds support for Cloudflare Workers and Vercel Edge serverless environments by detecting and utilizing the waitUntil() API to ensure log drain operations complete before the runtime terminates.

Changes:

  • Extended ServerEvent type definition to include optional cloudflare.context.waitUntil and waitUntil properties for Cloudflare Workers and Vercel Edge contexts
  • Modified callDrainHook function in the Nitro plugin to detect and use waitUntil() when available, preferring Cloudflare's implementation over Vercel's
  • Added comprehensive test suite with 5 test cases covering Cloudflare Workers, Vercel Edge, mixed contexts, traditional Node.js, and null event scenarios
  • Updated adapter documentation with a callout highlighting automatic serverless support

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
packages/evlog/src/types.ts Extends ServerEvent interface with optional cloudflare and waitUntil properties to support serverless runtime contexts
packages/evlog/src/nitro/plugin.ts Refactors callDrainHook to detect and use platform-specific waitUntil() API for ensuring drain completion in serverless environments
packages/evlog/test/nitro-plugin.test.ts Adds comprehensive test suite covering all waitUntil scenarios including Cloudflare Workers, Vercel Edge, preference logic, and edge cases
apps/docs/content/3.adapters/1.overview.md Adds informational callout documenting automatic serverless support for Cloudflare Workers and Vercel Edge

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@HugoRCD HugoRCD merged commit 942178f into main Feb 4, 2026
19 checks passed
@HugoRCD HugoRCD deleted the feat/wait-until branch February 4, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants