Hi i am developing a nextjs app and use

Hi, i am developing a nextjs app and use npx @cloudflare/next-on-pages@1 --watch and npx [email protected] pages dev .vercel/output/static --compatibility-date=2023-08-14 --live-reload --compatibility-flag=nodejs_compat in parallel. As soon as i edit a file that will be a function the recompiling leads to a crash of wrangler. Is there anything i did wrong?
7 Replies
telefonmann
telefonmannOP16mo ago
The error message contains: error: Could not resolve "<path>/.vercel/output/static/_worker.js/index.js
JacobMGEvans
JacobMGEvans16mo ago
@dario_p @gregbrimble Ya'll seem to be close to the Next On Pages CLI tool
Dario
Dario16mo ago
Hi there 🙂 yes I think this is a bit of a known issue... let me dig up the workers-sdk gh issue... https://github.com/cloudflare/workers-sdk/issues/3619 so this is unfortunately not working right now 😓 there's a PR to fix the crushing: https://github.com/cloudflare/workers-sdk/pull/3695 but I was digging into this a while back and even without the crushing things aren't wired up correctly with the _worker.js dir and the live reload fails to see changes in there.... the PR I just linked should be pretty straightforward to merge, for the live realod issue I am not sure I remember things not being too clear cut for me, @gregbrimble should be able to help better there 🙂 from your command I can see that you are not using bindings, so even if it won't be 100% representative of the real production environment I could simply run next dev and use @cloudflare/next-on-pages only when you want to deploy the application if you needed to @Better James has also created a nifty small library that can also allow you to access bindings when using next dev: https://github.com/james-elicx/cf-bindings-proxy so even though we suggest using the commands you shared, that's not really in a very good place currently 😓 🙏
telefonmann
telefonmannOP16mo ago
I configured the bindings in wrangler.toml. Thank you very much for the workaround. I will try it next week.
Dario
Dario16mo ago
sure, we're always here to help 🙂 👍 , by the way wrangler pages dev doesn't actually read the wrangler.toml file so configuring the bindings there doesn't actually make a difference, they need to be set up in the dashboard for the deployed application and throw cli arguments for local development
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
James
James15mo ago
I would recommend just using next dev to be honest
Want results from more Discord servers?
Add your server