cloudflare / cloudflare/workers-sdk

🐛 BUG: wrangler pages dev address in use windows handling

Open
#5,544 3 comments 0 reactions 3 assignees Claimed by @stritt View on GitHub
package:wrangler product:pages
Dominant language
TypeScript
Stars
4.5k
Forks
1.5k
Avg merge
3d 8h
Merged PRs (30d)
187

Description

### Which Cloudflare product(s) does this pertain to?

Wrangler core

### What version(s) of the tool(s) are you using?

3.48.0

### What version of Node are you using?

20.12.1

### What operating system and version are you using?

Windows 11

### Describe the Bug

### Observed behavior

When running `npx wrangler@3.48.0 pages dev public` once, and then again on Windows, rather than erroring with a nice error like this:
```
✘ [ERROR] Address already in use (127.0.0.1:8787). Please check that you are not already running a server on this address or specify a different port with --port.
```

it errors with a hard to understand stack trace like this:
```
C:\Users\james\AppData\Local\npm-cache\_npx\d77349f55c2be1c0\node_modules\wrangler\wrangler-dist\cli.js:29573
throw a;
^

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

(0, import_assert8.default)(!isClientError(syncRes.status))

at #parseSyncResponse (C:\Users\james\AppData\Local\npm-cache\_npx\d77349f55c2be1c0\node_modules\miniflare\dist\src\index.js:6157:32)
at ProxyStubHandler.get (C:\Users\james\AppData\Local\npm-cache\_npx\d77349f55c2be1c0\node_modules\miniflare\dist\src\index.js:6194:39)
at Miniflare2.getWorker (C:\Users\james\AppData\Local\npm-cache\_npx\d77349f55c2be1c0\node_modules\miniflare\dist\src\index.js:9200:36)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async ProxyController.reconnectInspectorProxyWorker (C:\Users\james\AppData\Local\npm-cache\_npx\d77349f55c2be1c0\node_modules\wrangler\wrangler-dist\cli.js:172635:36)
at async Promise.all (index 1) {
generatedMessage: true,
code: 'ERR_ASSERTION',
actual: false,
expected: true,
operator: '=='
}
```

### Expected behavior

As on macOS, it should error more gracefully with something like:
```
✘ [ERROR] Address already in use (127.0.0.1:8787). Please check that you are not already running a server on this address or specify a different port with --port.
```

### Steps to reproduce

- Empty directory
- Add `hello` to a `public/index.html` file
- Run `npx wrangler@3.48.0 pages dev public`
- Without closing the previous terminal, open another one and run the same command again

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.