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. 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.
@highlight-run/node 3.4.x: Dynamic require of async_hooks is not supported
- Highlightorganization
- H.inittool
- @opentelemetry/context-async-hookslibrary
- @opentelemetry/sdk-trace-nodelibrary
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.
Source: https://github.com/highlight/highlight/issues/6747
Source: https://github.com/highlight/highlight/issues/6747