workers-sdk
workers-sdk copied to clipboard
🐛 BUG: wrangler dev does not work on Termux/Android
What version of Wrangler
are you using?
2.0.27
What operating system are you using?
Android
Describe the Bug
I realize I may be a freak for developing on Android, but alas I do and I'm unable to perform the quick Workers example on the readme.
The npx wrangler dev index.js
command does run "successfully", but it spam reloads and the server is inaccessible.
Pretty much the same result whether or not I pass --local
. A basic Express server runs fine on this device so I don't think there's anything wrong with my environment.
Hey @Resonious, don't suppose you have any tips/guides for setting up an android to replicate this bug?
@rozenmd Sorry for the slow follow-up! One popular Android terminal emulator is Termux.
On Termux, you can pkg install nodejs
and npx wrangler generate test
. Running npx wrangler dev
on the fresh project will reproduce this issue.
Invoking Miniflare directly appears to work fine, so I'm guessing there's something about the way Wrangler forks Miniflare that Android doesn't like.
Quick update! I have some free time today so I'm looking into this. So far I've traced this back to the esbuild watcher. The watcher seems to be constantly reporting changes. If I remove the bundle from the React effect that restarts the server, it "works" as long as I toggle local mode or do something else to kick off the initial build/run.
I'm going to see if I can figure out whether this is actually an esbuild bug on Android or if there's some config we can pass to calm it down.
This seems related but it's supposedly fixed already: https://github.com/evanw/esbuild/issues/1113
Yeah okay sorry for the spam. I was able to reproduce this with just esbuild: esbuild --bundle --watch index.js
.
I opened an issue on esbuild itself: https://github.com/evanw/esbuild/issues/2640 - once that's fixed, all we need to do is update the esbuild dependency in Wrangler.
This problem seems to still exist in the latest release (2.4.4)