-
Notifications
You must be signed in to change notification settings - Fork 150
fix(cloudflare-workers): do not use i/o operations outside fetch context #4042
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
base: main
Are you sure you want to change the base?
fix(cloudflare-workers): do not use i/o operations outside fetch context #4042
Conversation
How to use the Graphite Merge QueueAdd the label merge-queue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Code Review - PR #4042SummaryThis PR addresses a Cloudflare Workers-specific issue by conditionally preparing the runtime only when necessary. The change prevents I/O operations from running outside of the fetch context, which is prohibited in Cloudflare Workers. ✅ Positive Aspects
🔍 Issues & Concerns1. Logic Error - Missing
|

Closes RVT-5342
TL;DR
Only auto-prepare the runtime when necessary based on configuration.
What changed?
Added a conditional check before auto-preparing the runtime in the Registry constructor. Now, the runtime is only auto-prepared when either
config.serverless?.spawnEngineorconfig.serveManageris set to a truthy value.Also reordered the imports to place the Runtime import with the other imports from external files.
How to test?
serverless.spawnEngineset tofalseandserveManagerset tofalseserverless.spawnEngineorserveManagerset totrueWhy make this change?
This optimization prevents unnecessary runtime preparation when it's not needed based on the configuration. This can improve performance and reduce resource usage in scenarios where the runtime isn't required.