You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running wrangler dev in a GitHub Action, we are experiencing the local server reloading randomly. It doesn't always do it, but to date I haven't yet been able to figure out why.
⛅️ wrangler 3.2.0
------------------
wrangler dev now uses local mode by default, powered by 🔥 Miniflare and 👷 workerd.
To run an edge preview session for your Worker, use wrangler dev --remote
Your worker has access to the following bindings:
- Vars:
- redacted: "redacted"
- ENV: "development"
⎔ Starting local server...
[mf:inf] Ready on http://127.0.0.1:3000/
⎔ Reloading local server...
/runner/_work/xyz/node_modules/wrangler/wrangler-dist/cli.js:30632
throw a;
^
Error: connect ECONNREFUSED 127.0.0.1:[41](https://github.com/xyz/actions/runs/5545002487/jobs/10123297740?pr=11225#step:10:42)[45](https://github.com/xyz/actions/runs/5545002487/jobs/10123297740?pr=11225#step:10:46)9
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1278:16)
Emitted 'error' event on WebSocket instance at:
at emitErrorAndClose (/runner/_work/xyz/node_modules/wrangler/wrangler-dist/cli.js:108968:17)
at ClientRequest.<anonymous> (/runner/_work/xyz/node_modules/wrangler/wrangler-dist/cli.js:108864:9)
at ClientRequest.emit (node:events:513:28)
at Socket.socketErrorListener (node:_http_client:[49](https://github.com/xyz/actions/runs/5545002487/jobs/10123297740?pr=11225#step:10:50)4:9)
at Socket.emit (node:events:[51](https://github.com/xyz/actions/runs/5545002487/jobs/10123297740?pr=11225#step:10:52)3:28)
at emitErrorNT (node:internal/streams/destroy:1[57](https://github.com/xyz/actions/runs/5545002487/jobs/10123297740?pr=11225#step:10:58):8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -111,
code: 'ECONNREFUSED',
syscall: 'connect',
address: '127.0.0.1',
port: 41459
}
After reloading the local server, wrangler tries to reconnect but uses a random port. In the example ☝️ case, it chooses port 41459 instead of the port 3000 that was configured and first connected to.
I know that running dev in a CI environment might be strange, but most of the times this is working for the particular testing that we are doing.
To get around this issue, I wanted to turn off the "watch" feature of development mode. I did a yarn patch like this:
diff --git a/wrangler-dist/cli.js b/wrangler-dist/cli.js
index 923ce6b66301e94168a07595495fdf47de8c9f86..d61fc4ba64d19eb115fd7bf13f7ef8736e818a1f 100644
--- a/wrangler-dist/cli.js+++ b/wrangler-dist/cli.js@@ -127986,6 +127986,9 @@ function useLocalWorker(props) {
miniflareServerRef.current = void 0;
});
} else {
+ if (props.bindings.vars?.['no-refresh']) {+ return;+ }
logger.log(import_chalk4.default.dim("\u2394 Reloading local server..."));
}
const currentServer = server2;
And running wrangler like this yarn dev --var no-refresh:true is working perfectly.
This issue consists then of two parts:
Any idea on why the server is restarting as if a watched file has changed.
Is a --turn-off-reloading type of flag something we could add to the list of dev command options?
Thank you!
The text was updated successfully, but these errors were encountered:
Any idea on why the server is restarting as if a watched file has changed.
Are you running multiple of these servers on the same CI machine? It's possible the servers are restarting because of Wrangler's service registry, which attempts to automatically link wrangler dev sessions so you can add service bindings between them. When a new wrangler dev session starts, others will reload.
Is a --turn-off-reloading type of flag something we could add to the list of dev command options?
Probably not. Instead, I'd recommend you look at https://developers.cloudflare.com/workers/wrangler/api/#unstable_dev. It provides a programatic API for wrangler dev, and in the default configuration, doesn't support reloading, so shouldn't exhibit the problems you're seeing.
hi @tvthatsme 👋 we haven't heard from you in a while, so we’re going to close this issue for now. if this is still a problem, please feel free to open a new issue referencing this one. please be sure to include an updated summary and any additional requested details, followup, or context and we will revisit and investigate further. thanks!
Which Cloudflare product(s) does this pertain to?
Wrangler
What version of
Wrangler
are you using?3.2.0
What operating system are you using?
Linux
Describe the Bug
When running
wrangler dev
in a GitHub Action, we are experiencing the local server reloading randomly. It doesn't always do it, but to date I haven't yet been able to figure out why.After reloading the local server, wrangler tries to reconnect but uses a random port. In the example ☝️ case, it chooses port
41459
instead of the port3000
that was configured and first connected to.I know that running
dev
in a CI environment might be strange, but most of the times this is working for the particular testing that we are doing.To get around this issue, I wanted to turn off the "watch" feature of development mode. I did a yarn patch like this:
And running wrangler like this
yarn dev --var no-refresh:true
is working perfectly.This issue consists then of two parts:
Thank you!
The text was updated successfully, but these errors were encountered: