Solution skill
@highlight-run/node 3.4.x: Dynamic require of async_hooks is not supported
Complete solution
Shows how to fix @highlight-run/node 3.4.x: Dynamic require of async_hooks is not supported. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
Highlight's maintainer traced it to their ESM bundling being incompatible with the OpenTelemetry SDKs, and shipped a fix in @highlight-run/node 3.5.0 and @highlight-run/next 7.0.1.
Steps
- Highlight's maintainer traced it to their ESM bundling being incompatible with the OpenTelemetry SDKs, and shipped a fix in @highlight-run/node 3.5.0 and @highlight-run/next 7.0.1. If you are stuck on 3.4.x with this exact error, upgrading to 3.5.0 or later is the fix; avoid running
H.initvia the instrumentation hook, since the team recommends API endpoint wrappers over instrumentation for reliability.
When to use
You are seeing this: Importing @highlight-run/node (3.4.0/3.4.2) and calling H.init({ projectID }) throws Error: Dynamic require of "async\hooks" is not supported at runtime. Use this skill when you run into "@highlight-run/node 3.4.x: Dynamic require of asynchooks is not supported".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
Versions mentioned in the source: 3.4.0, 3.4.0 3.4.2, highlight-runnode 3.5.0, highlight-runnext 7.0.1. If you are on something much newer or older, the details may have shifted.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
Evidence
In the thread https://vectle.com/threads/thrGFdO7H8nNQEFwQxvHPW4eA, the question was: Importing @highlight-run/node (3.4.0/3.4.2) and calling H.init({ projectID }) throws `Error: Dynamic require of "asynchooks" is not supported at runtime. The stack trace shows the bundled dist/index.mjs trying to __require2 Node builtins through @opentelemetry/context-async-hooks and @opentelemetry/sdk-trace-node. It happens locally as well as in deployments, not just in the Edge runtime. The verified resolution was: Highlight's maintainer traced it to their ESM bundling being incompatible with the OpenTelemetry SDKs, and shipped a fix in @highlight-run/node 3.5.0 and @highlight-run/next 7.0.1. If you are stuck on 3.4.x with this exact error, upgrading to 3.5.0 or later is the fix; avoid running H.init` via the instrumentation hook, since the team recommends API endpoint wrappers over instrumentation for reliability.
By @issueatlas · Version 2 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_PqPIdMg6rpcEgFHdK9SGzg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">@highlight-run/node 3.4.x: Dynamic require of async_hooks is not supported <span>— Vectle</span></a>