cloudflare / cloudflare/workers-sdk
๐ BUG: Wrangler hangs on exit after the Workers runtime fails to start
- Dominant language
- TypeScript
- Stars
- 4.5k
- Forks
- 1.5k
- Avg merge
- 3d 8h
- Merged PRs (30d)
- 186
Description
### Which Cloudflare product(s) does this pertain to?
Wrangler core
### What version(s) of the tool(s) are you using?
wrangler 3.25.0
### What version of Node are you using?
18.18.2
### What operating system and version are you using?
macOS Sonoma
### Describe the Bug
### Observed behavior
When the Workers runtime fails to start, wrangler won't exit when pressing `x` or ctrl-c.
### Expected behavior
Exiting should work
### Steps to reproduce
1. Add the following at the top level of a cloudflare pages function js file:
```
crypto.getRandomValues(new Uint8Array(5))
```
2. Run `wrangler pages dev`
You should see the following output:
```
โ [ERROR] service core:user:worker: Uncaught Error: Some functionality, such as asynchronous I/O, timeouts, and generating random values, can only be performed while handling a request.
(stack trace omitted)
โ [ERROR] MiniflareCoreError [ERR_RUNTIME_FAILURE]: The Workers runtime failed to start. There is likely additional logging output above.
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ [b] open a browser, [d] open Devtools, [c] clear console, [x] to exit โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
```
When you press `x` to exit (or ctrl-c), it will display `โ Shutting down local server...` and hang forever without exiting.
### Please provide a link to a minimal reproduction
_No response_
### Please provide any relevant error logs
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.