Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Pages never connects to external workers in local development #7322

Closed
samuelmarcos-cpu opened this issue Nov 21, 2024 · 6 comments · Fixed by #7381
Closed

🐛 BUG: Pages never connects to external workers in local development #7322

samuelmarcos-cpu opened this issue Nov 21, 2024 · 6 comments · Fixed by #7381
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working

Comments

@samuelmarcos-cpu
Copy link

samuelmarcos-cpu commented Nov 21, 2024

Which Cloudflare product(s) does this pertain to?

C3 (npm create cloudflare), Pages, Wrangler

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

3.88.0 [Wrangler]

What version of Node are you using?

22.9.0

What operating system and version are you using?

Windows 11, Linux Ubuntu WSL

Describe the Bug

Observed Behavior

After configuring and starting a connection from an ES module worker to a page, the page, which was run with npx wrangler pages dev, never connects to the worker, which is also running in another terminal with npx wrangler dev.

Expected Behavior

It is expected that after running the dev command for the page project and then running the dev command for the worker project, the page project should be able to connect to the worker running locally, as described in the documentation.

Steps to Reproduce

This scenario can be easily tested by creating each of the projects with the command npm create cloudflare@latest.

Setup Worker Project

  • Run npm create cloudflare@latest -- worker-a
  • Select the first option Hello World example
  • Choose the default options for the remaining choices
  • Run npm run dev

Setup Page Project

  • Run npm create cloudflare@latest -- pages-nuxt
  • Select the second option Framework Starter
  • Choose the NUXT framework (I also tested using another framework like NEXT, but encountered the same issue)
  • Choose the default options for the remaining choices
  • Run npx wrangler pages dev --service WORKER_A=worker-a

After running both projects in development mode, regardless of the order in which they were started, the output in the pages project will be:

- Services:
  - WORKER_A: worker-a [not connected]

Indicating that the page project did not connect to the worker-a.

I reviewed the documentation, repeated this process on Linux, tested switching from NUXT to NEXT, and had no success. Therefore, I am reporting this issue as a bug.

Note

This issue might be related to another request

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

No response

@samuelmarcos-cpu samuelmarcos-cpu added the bug Something that isn't working label Nov 21, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 21, 2024
@mfromoops
Copy link

mfromoops commented Nov 23, 2024

I'm having the same issue on 3.90.0 using NextJS

using wrangler on 3.65 works for me, but I'm using workflows on some of the workers, which are not supported on that version

@mfromoops
Copy link

Seems to be working on 3.87.0

@emily-shen
Copy link
Contributor

Thanks for the reports! #7081 in 3.88.8 might've caused this :/ Can you add --x-registry=false to both dev commands and see if that fixes it?

@emily-shen emily-shen added the awaiting reporter response Needs clarification or followup from OP label Nov 25, 2024
@samuelmarcos-cpu
Copy link
Author

@emily-shen

It worked! I tested running npx wrangler on the worker and Nuxt pages after building, with x-registry=false.

It also works by setting x-registry=false only when executing the worker and running the pages with npx wrangler pages dev after the build, without x-registry=false.

However, it still doesn't work when I use the standard npm run dev for a fullstack pages project like Nuxt. So, this is not a definitive solution because it is impractical to manually build the project every time a code change is made.

Remember that this problem also happens with the Next framework, so I imagine this is happening for all other fullstack frameworks that Wrangler supports.

@bdmackie
Copy link

bdmackie commented Nov 26, 2024

@emily-shen I have the same issue (with SvelteKit app as the Pages caller). x-registry=false on both caller and callee dev invocations addressed the issue, however strangely it only connects if you start the callee worker after the caller pages app.

Edit: I realise I said the same thing as samuel above... i.e. removing -x-registry=false on caller's wrangler pages dev gets it working.

@emily-shen
Copy link
Contributor

cc @penalosa @andyjessop :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting reporter response Needs clarification or followup from OP bug Something that isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants