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: sveltekit quickstart gives a 500 server error - 'No such module "node:async_hooks"' #7395

Open
filipe-freire opened this issue Nov 30, 2024 · 3 comments
Labels
bug Something that isn't working c3 Relating to C3 (create-cloudflare) package

Comments

@filipe-freire
Copy link

filipe-freire commented Nov 30, 2024

Which Cloudflare product(s) does this pertain to?

Pages

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

3.91.0 [Wrangler], 9.13.2 [pnpm]

What version of Node are you using?

22.11.0

What operating system and version are you using?

Linux (Pop!_OS jammy 22.04 x86_64) | Kernel: Linux 6.9.3-76060903-generic

Describe the Bug

Observed behavior

Upon running the step to jumpstart a new sveltekit project through the CLI shown in the Cloudflare website, all appears to run smoothly (with no errors on the terminal) up until the "DNS propagation/waiting for the deployment to become available" step.

Right after "DNS propagation complete." the terminal outputs timed out while waiting for https://<project-name>.pages.dev - try accessing it in a few minutes..

Upon waiting +30min, the page is still showing a 500 Internal Server Error.
Inspecting the cloudflare pages logs show an error: ` No such module "node:async_hooks"

My best guess is that some 3rd party library integration is requiring that module causing it to show, since choosing a simple sveltekit app with no integrations does not cause the error and the deployment goes through without issue. I'll update the issue with my findings.

Expected behavior

The CFPages project should deploy successfully without any errors.

Steps to reproduce

  • Run the command shown in the CF docs to quicktstart & deploy a SvelteKit project to CFPages: pnpm create cloudflare@latest my-svelte-app --framework=svelte

Chosen CLI options:

Which template would you like?
│  SvelteKit minimal
│
◇  Add type checking with Typescript?
│  Yes, using Typescript syntax
│
◆  Project created
│
◇  What would you like to add to your project? (use arrow keys / space bar)
│  prettier, eslint, vitest, tailwindcss, drizzle, paraglide, playwright
│
◇  tailwindcss: Which plugins would you like to add?
│  typography, forms
│
◇  Which package manager do you want to install dependencies with?
│  pnpm

Please provide a link to a minimal reproduction

No response

Please provide any relevant error logs

The redacted error log shown in the CFPages dashboard for the project:

{
  "truncated": false,
  "executionModel": "stateless",
  "outcome": "ok",
  "scriptVersion": {
    "id": "c5af4521-516a-41e3-899e-bd075efeed9a"
  },
  "scriptName": "pages-worker--4510812-production",
  "diagnosticsChannelEvents": [],
  "exceptions": [],
  "logs": [
    {
      "message": [
        "Error: No such module \"node:async_hooks\"."
      ],
      "level": "error",
      "timestamp": 1732976236667
    }
  ],
  "eventTimestamp": 1732976236660,
  "event": {
    "request": {
      "url": "https://<project-name>.pages.dev/",
      "method": "GET",
      "headers": {
       ...
      },
      "cf": {
        "httpProtocol": "HTTP/3",
        "tlsCipher": "AEAD-AES128-GCM-SHA256",
        "continent": "EU",
        "asn": 2840,
        "clientAcceptEncoding": "gzip, deflate, br, zstd",
        "country": "SE",
        "isEUCountry": "1",
        "verifiedBotCategory": "",
        "tlsClientAuth": {
          ...
        },
        "tlsExportedAuthenticator": {
          ...
        },
        "botManagement": {
          "corporateProxy": false,
          "verifiedBot": false,
          "jsDetection": {
            "passed": false
          },
          "staticResource": false,
          "detectionIds": {},
          "score": 99
        }
      }
    },
    "response": {
      "status": 500
    }
  },
  "id": 1
}
@filipe-freire filipe-freire added the bug Something that isn't working label Nov 30, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Nov 30, 2024
@filipe-freire
Copy link
Author

filipe-freire commented Nov 30, 2024

After some triaging, the issue seems to be due to the package paraglide, as installing the following combination of packages prettier, eslint, vitest, tailwindcss, drizzle seems to not trigger the error, making the deployment go through successfully.

I also found this page, which shows that node:async_hooks is not yet supported by WorderD & Wrangler, although I'm not 100% sure how up-to-date the info is here.

If anyone is more knowledgeable about this issue/domain, please feel free to pitch in :)

@edmundhung edmundhung added error-messaging Improving user facing error messages and removed error-messaging Improving user facing error messages labels Dec 16, 2024
@edmundhung edmundhung moved this from Untriaged to Backlog in workers-sdk Dec 16, 2024
@edmundhung edmundhung added the c3 Relating to C3 (create-cloudflare) package label Dec 16, 2024
@edmundhung
Copy link
Member

edmundhung commented Dec 16, 2024

Thanks for raising this issue, @filipe-freire!

We do have basic support for some APIs from node:async_hooks. Could you check if adding nodejs_als or nodejs_compact to the compatibility_flags config resolves the issue?

@filipe-freire
Copy link
Author

filipe-freire commented Dec 16, 2024

Hey @edmundhung, thanks for pitching in!

I assume you meant the flag nodejs_compat? After consulting this page and adding the flag nodejs_compat to my wrangler.toml, the deployment went through successfully! 🎉

If I understand correctly, that flag needs to be added if some specific node internals are used in the app, correct?

If so, maybe it'd be beneficial to add the nodejs_compat flag to the wrangler.toml from the get-go, when scaffolding new apps through the CLI, since as a user, one cannot be sure if external dependencies rely on those node internals or not.

A comment could also be added there explaining the need for such flag in the first place, and referencing the user to the link shared above, in order to provide a smoother deployment experience.

Any thoughts? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something that isn't working c3 Relating to C3 (create-cloudflare) package
Projects
Status: Backlog
Development

No branches or pull requests

2 participants