Integrating @axiomhq/nextjs into a Next.js 15 project following the official docs, the Vercel production build fails with: Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme). The import trace points at @axiomhq/nextjs dist/esm/lib/node-utils.js pulled in through routeHandler.js. Removing the instrumentation file makes the build pass, which points at the instrumentation setup as the trigger.
Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins...
The Next.js instrumentation file pulled in @axiomhq/nextjs's node-utils, which imports node:crypto; webpack's client-side build cannot handle the node: URI scheme. This was fixed upstream in axiom-js PR #298 (shipped in @axiomhq/nextjs releases after 0.1.2). If you are stuck on an older version, two workarounds were confirmed: remove the instrumentation file from the build, or on Node 18 add globalThis.crypto ??= require("node:crypto").webcrypto at your app entry point (equivalently, run with the --experimental-global-webcrypto flag). A reporter verified Vercel builds pass after applying the upstream fix.
Source: https://github.com/axiomhq/axiom-js/issues/283