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

Serve command timeout issue after upgrade (v2.2.0) #58

Closed
1 of 4 tasks
mnlbox opened this issue Jul 28, 2024 · 13 comments
Closed
1 of 4 tasks

Serve command timeout issue after upgrade (v2.2.0) #58

mnlbox opened this issue Jul 28, 2024 · 13 comments

Comments

@mnlbox
Copy link

mnlbox commented Jul 28, 2024

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:

Connecting on 127.0.0.1:4002

 ⛅️ wrangler 3.67.1
-------------------

⎔ Starting local server...
[wrangler:inf] Ready on http://localhost:4002
╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ [b] open a browser, [d] open Devtools, [l] turn off local mode, [c] clear console, [x] to exit                           │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Connecting on 127.0.0.1:4002

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

pnpm nx report

 NX   Report complete - copy this into the issue template

Node   : 20.14.0
OS     : linux-arm64
pnpm   : 9.6.0

nx                 : 18.3.3
@nx/js             : 18.3.3
@nx/jest           : 18.3.3
@nx/linter         : 18.3.3
@nx/eslint         : 18.3.3
@nx/workspace      : 18.3.3
@nx/devkit         : 18.3.3
@nx/esbuild        : 18.3.3
@nx/eslint-plugin  : 18.3.3
@nx/nest           : 18.3.3
@nx/node           : 18.3.3
@nx/playwright     : 18.3.3
@nx/react          : 18.3.3
@nrwl/tao          : 18.3.3
@nx/vite           : 18.3.3
@nx/web            : 18.3.3
@nx/webpack        : 18.3.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
@nx/vite/plugin
@nx/playwright/plugin
---------------------------------------
Community plugins:
@naxodev/nx-cloudflare : 2.2.0

Failure Logs

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

I'm using Linux in a Mac with VsCode devContainer

@mnlbox mnlbox changed the title Serve command timeout issue after upgrade Serve command timeout issue after upgrade (v2.2.0) Jul 28, 2024
@NachoVazquez
Copy link
Contributor

Hey @mnlbox, thanks for creating this issue. I will take a look today.

@NachoVazquez
Copy link
Contributor

@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.

@NachoVazquez
Copy link
Contributor

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.

@mnlbox
Copy link
Author

mnlbox commented Jul 28, 2024

I'm currently using "@naxodev/nx-cloudflare : 2.2.0" based on the table here it's the version that working with Nx 18:
image

@NachoVazquez
Copy link
Contributor

Thanks; I missed that. I thought you were using the last one.

@NachoVazquez
Copy link
Contributor

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.

@mnlbox
Copy link
Author

mnlbox commented Jul 28, 2024

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/[email protected]_@[email protected]/node_modules/wrangler/wrangler-dist/cli.js:29765
            throw a;
            ^

TypeError: fetch failed
    at Object.fetch (/mytest/node_modules/.pnpm/[email protected]/node_modules/undici/index.js:112:15)
    at async fetch3 (/mytest/node_modules/.pnpm/[email protected]/node_modules/miniflare/dist/src/index.js:4303:20)
    at async Miniflare2.dispatchFetch (/mytest/node_modules/.pnpm/[email protected]/node_modules/miniflare/dist/src/index.js:9332:22)
    at async Mutex.runWith (/mytest/node_modules/.pnpm/[email protected]/node_modules/miniflare/dist/src/index.js:3521:16)
    at async ProxyController.sendMessageToProxyWorker (/mytest/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/wrangler-dist/cli.js:209940:7) {
  cause: HeadersTimeoutError: Headers Timeout Error
      at Timeout.onParserTimeout [as callback] (/mytest/node_modules/.pnpm/[email protected]/node_modules/undici/lib/client.js:1048:28)
      at Timeout.onTimeout [as _onTimeout] (/mytest/node_modules/.pnpm/[email protected]/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

@mnlbox
Copy link
Author

mnlbox commented Jul 28, 2024

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?

@NachoVazquez
Copy link
Contributor

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",

@mnlbox
Copy link
Author

mnlbox commented Jul 28, 2024

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. 🤔

@mnlbox
Copy link
Author

mnlbox commented Jul 28, 2024

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: vitejs/vite#16522 (comment)

@NachoVazquez
Copy link
Contributor

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.

@mnlbox
Copy link
Author

mnlbox commented Aug 14, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants