mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
When a `SyntheticModule` callback was wrapped in an `AsyncContextFrame` on the main globalObject (where async context tracking is enabled), evaluating it on a `NodeVMGlobalObject` would crash because the tracking flag wasn't propagated. `AsyncContextFrame::call` checks `isAsyncContextTrackingEnabled()` to decide whether to unwrap the frame — without the flag, it takes the fast path and tries to call the `AsyncContextFrame` wrapper directly, which is not callable. The async context data (`m_asyncContextData`) was already shared between parent and `NodeVMGlobalObject`, but the tracking flag was missing. This adds propagation of `isAsyncContextTrackingEnabled` alongside the data. **Repro:** `react-email` v5.2.5 preview server crashes when rendering a template because it imports `node:async_hooks` (enabling async context tracking) and uses `node:vm` `SyntheticModule` for module evaluation. Fixes #26540 --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>