cloudflare / cloudflare/workers-sdk
[vite-plugin] vite build can hang with remote bindings when Worker has no config path
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 187
Description
### Description
The remote proxy session cleanup added in #15269 only disposes sessions stored in `remoteProxySessionsDataMap`. Sessions are added to that map only when the Worker has a truthy `configPath`.
With `experimental.newConfig` and the Build Output Specification path, `resolveWorkerConfig()` is called with `configPath: undefined`. When remote bindings are enabled, the proxy session is still started, but it is not tracked for reuse or disposal. Its listening server can therefore keep the event loop alive after build output has completed, causing `vite build` to hang.
### Expected behavior
Every started remote proxy session is tracked independently of `configPath` and disposed when the build or dev server closes. The `configPath`-keyed map can remain the reuse cache.
### Context
- Follow-up to #15173 and #15269
- Review finding: https://github.com/cloudflare/workers-sdk/pull/15269#discussion_r3814282245
- Scope discussion: https://github.com/cloudflare/workers-sdk/pull/15269#discussion_r3814397227
Contributor guide
Research direction
Trace remote proxy session creation and cleanup around resolveWorkerConfig() and remoteProxySessionsDataMap, focusing on the experimental.newConfig and Build Output Specification paths where configPath is undefined. Reproduce the remote-bindings build, then verify every started session is tracked and disposed so vite build exits after output completes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vite
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100