workers-sdk icon indicating copy to clipboard operation
workers-sdk copied to clipboard

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

Open aroman opened this issue 1 year ago • 2 comments

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

aroman avatar Jun 12 '24 07:06 aroman

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

petebacondarwin avatar Jun 13 '24 15:06 petebacondarwin

hey @petebacondarwin, did you end up putting that PR anywhere?

aroman avatar Aug 29 '24 00:08 aroman

https://github.com/cloudflare/workers-sdk/pull/6620

petebacondarwin avatar Sep 03 '24 08:09 petebacondarwin