Closed mnlbox closed 3 months ago
Hey @mnlbox, thanks for creating this issue. I will take a look today.
@mnlbox, the latest version of this package only supports Nx ^19.0.0; your workspace is using Nx 18.3, which, depending on your package manager, can try to install both versions of nx simultaneously, which could cause weird issues. I cannot guarantee that's the issue here. But it doesn't help.
Please create a reproduction of the problem and share it here so I can be more helpful. I was not able to reproduce it locally.
I'm currently using "@naxodev/nx-cloudflare : 2.2.0" based on the table here it's the version that working with Nx 18:
Thanks; I missed that. I thought you were using the last one.
I attempted to replicate the issue in a new repository but was unsuccessful. I would greatly appreciate your help in creating a reproduction so I can figure out a possible plugin issue.
I tried to test my app directly with wrangler
command but I got timeout error like this:
pnpm wrangler dev services/test/src/index.ts
⛅️ wrangler 3.67.1
-------------------
[wrangler:inf] Ready on http://localhost:8787
⎔ Starting local server...
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
/mytest/node_modules/.pnpm/wrangler@3.67.1_@cloudflare+workers-types@4.20240524.0/node_modules/wrangler/wrangler-dist/cli.js:29765
throw a;
^
TypeError: fetch failed
at Object.fetch (/mytest/node_modules/.pnpm/undici@5.28.4/node_modules/undici/index.js:112:15)
at async fetch3 (/mytest/node_modules/.pnpm/miniflare@3.20240718.1/node_modules/miniflare/dist/src/index.js:4303:20)
at async Miniflare2.dispatchFetch (/mytest/node_modules/.pnpm/miniflare@3.20240718.1/node_modules/miniflare/dist/src/index.js:9332:22)
at async Mutex.runWith (/mytest/node_modules/.pnpm/miniflare@3.20240718.1/node_modules/miniflare/dist/src/index.js:3521:16)
at async ProxyController.sendMessageToProxyWorker (/mytest/node_modules/.pnpm/wrangler@3.67.1_@cloudflare+workers-types@4.20240524.0/node_modules/wrangler/wrangler-dist/cli.js:209940:7) {
cause: HeadersTimeoutError: Headers Timeout Error
at Timeout.onParserTimeout [as callback] (/mytest/node_modules/.pnpm/undici@5.28.4/node_modules/undici/lib/client.js:1048:28)
at Timeout.onTimeout [as _onTimeout] (/mytest/node_modules/.pnpm/undici@5.28.4/node_modules/undici/lib/timers.js:20:13)
at listOnTimeout (node:internal/timers:573:17)
at process.processTimers (node:internal/timers:514:7) {
code: 'UND_ERR_HEADERS_TIMEOUT'
}
}
Node.js v20.14.0
It seems it's related to "@cloudflare/workers-types" package. Which version of "@cloudflare/workers-types" package should I use with "@naxodev/nx-cloudflare" package?
For that version ^4.20240419.0
but "@cloudflare/workers-types," as its name indicates, are just types. It should not affect the runtime.
Try with this version of wrangler "wrangler": "^3.48.0",
I don't know why but after adding ip
config to the serve
command now it's working. So this one is not working and stuck when I try to serve it:
"serve": {
"executor": "@naxodev/nx-cloudflare:serve",
"options": {
"port": 4001
}
},
But this one is working without any issue.
"serve": {
"executor": "@naxodev/nx-cloudflare:serve",
"options": {
"port": 4001,
"ip": "127.0.0.1" <--------------- I added this and it's working now
}
},
I don't know maybe it's a docker issue. 🤔
OK it seems it's a docker issue started from v 26.0.0
https://github.com/moby/moby/releases/tag/v26.0.0
So we should mention "ip": "127.0.0.1"
otherwise it will use IPv6.
Same issue for Vite here: https://github.com/vitejs/vite/issues/16522#issuecomment-2084322973
Great finding @mnlbox ! I'm glad you found a solution.
I will close this one now, but please let me know if you have any future issues or suggestions for improving the plugin! I hope you have a great week.
Sure, I'll create more Hono projects with your awesome tool next week. Hope to switch to the latest version and I'll back to you if I faced any issue.
Hi @NachoVazquez
I upgraded some of my packages and it seems all cloudflare workder projects that I have this monorepo stopped working. I don't have any error and I'm getting server is running like this:
But all request that I'm sending via Postman timeout after a long waiting. Any idea?
Steps to Reproduce
I even tried to test with a fresh new project but it seems the combination of packages with the versions mentioned below is not working.
Nx Report
Failure Logs
No response
Operating System
Additional Information
I'm using Linux in a Mac with VsCode devContainer