Wranglers Pages Dev is basically unusable

In locally testing a Next on Pages project, the documentation asks that you npx @cloudflare/next-on-pages --watch and in another terminal use wrangler pages dev .vercel/output/static --compatibility-flag=nodejs_compat. However, with this setup whenever you modify your Next project it triggers a rebuild, deleting _worker.js. Then, this file being deleted upsets wrangler and it exits. However, wrangler doesn't calmly exit - it leaves behind a process holding it's bind to :8788 meaning it cannot be restarted without running lsof -i 8778 and then killing the hanging process. Every. single. file change. I'm not sure how to use any other Cloudflare feature with Next on Pages because the thing giving me process bindings cannot be used without extreme babysitting. What, if anything, can I do locally to fix this or where do I report on GitHub?
6 Replies
Dj
DjOP16mo ago
Versions: ❯cloudflare/[email protected][email protected] System: Linux archlinux 6.4.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 27 Jul 2023 22:02:18 +0000 x86_64 GNU/Linux
James
James16mo ago
I would suggest using next dev instead for local development tbh. Then check every now and then that things are working okay with a build using wrangler if you wish. Regarding wrangler crashing, that's potentially something worth raising in the workers-sdk repo on GitHub.
Dj
DjOP16mo ago
Ideally I can test the whole app with next dev but I can't invoke any function that tries to access an r2 bucket with it :<
James
James16mo ago
Ah, that's unfortunate. You could try using something like cf-bindings-proxy perhaps (one of my repos), but I don't believe the R2 support is the best in that so it might be problematic 😦
Dj
DjOP16mo ago
I'm not sure if it's cf-bindings-proxy or my setup but I can't get R2 to return files through direct gets and lists. Going back to trying to use wrangler, I've opened this issue related to this. https://github.com/cloudflare/workers-sdk/issues/3696
GitHub
🐛 BUG: Wrangler throwing an error fails to clear port binding on ex...
Which Cloudflare product(s) does this pertain to? R2, Wrangler core What version(s) of the tool(s) are you using? 3.4.0 [Wrangler] What version of Node are you using? 18.16.0 What operating system ...
James
James16mo ago
Ah that's a shame, hopefully something can be done about wrangler!
Want results from more Discord servers?
Add your server