cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.42k stars 594 forks source link

🐛 BUG: wrangler does not mark `node:async_hooks` as external when `nodejs_als` compatibility flag is used #6011

Open aroman opened 3 weeks ago

aroman commented 3 weeks ago

Which Cloudflare product(s) does this pertain to?

Workers Runtime, Wrangler core

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

3.60.2

What version of Node are you using?

18

What operating system and version are you using?

macOS 14.5

Describe the Bug

Observed behavior

Please describe.

wrangler.toml

#: schema ../node_modules/wrangler/config-schema.json

compatibility_date = "2024-05-24"
main = "src/worker.ts"
compatibility_flags = ["nodejs_als"]

src/worker.ts

import { AsyncLocalStorage } from 'node:async_hooks'

Expected behavior

No warning is generated, since the "nodejs_als" compatibility flag is specified in wrangler.toml.

Actual behavior

▲ [WARNING] The package "node:async_hooks" wasn't found on the file system but is built into node.

from kian on Cloudflare's Discord:

Wrangler has no idea about that flag so it doesn’t know what to do with it. I'd open an issue

petebacondarwin commented 3 weeks ago

I can confirm this is a minor bug and I have a simple fix in the works.