@honeybadger-io/nextjs 5.11.5 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -42
- package/dist/capture-request-error.d.ts +35 -0
- package/dist/capture-request-error.test.d.ts +2 -0
- package/dist/capture-router-transition-start.d.ts +21 -0
- package/dist/client.d.ts +2 -0
- package/dist/copy-config-files.js +106 -34
- package/dist/copy-config-files.js.map +1 -1
- package/dist/edge.d.ts +2 -1
- package/dist/flush.d.ts +24 -0
- package/dist/honeybadger-nextjs-client.cjs.js +35 -0
- package/dist/honeybadger-nextjs-client.cjs.js.map +1 -0
- package/dist/honeybadger-nextjs-client.esm.js +27 -0
- package/dist/honeybadger-nextjs-client.esm.js.map +1 -0
- package/dist/honeybadger-nextjs-edge.cjs.js +320 -240
- package/dist/honeybadger-nextjs-edge.cjs.js.map +1 -1
- package/dist/honeybadger-nextjs-edge.esm.js +317 -240
- package/dist/honeybadger-nextjs-edge.esm.js.map +1 -1
- package/dist/honeybadger-nextjs.cjs.js +835 -387
- package/dist/honeybadger-nextjs.cjs.js.map +1 -1
- package/dist/honeybadger-nextjs.esm.js +829 -386
- package/dist/honeybadger-nextjs.esm.js.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/insights-instrumentation.d.ts +30 -2
- package/dist/insights.d.ts +72 -0
- package/dist/insights.test.d.ts +2 -0
- package/dist/setup.d.ts +11 -0
- package/dist/setup.test.d.ts +2 -0
- package/dist/source-maps.d.ts +55 -0
- package/dist/source-maps.test.d.ts +2 -0
- package/dist/types.d.ts +20 -8
- package/package.json +34 -12
- package/src/capture-request-error.test.ts +245 -0
- package/src/capture-request-error.ts +92 -0
- package/src/capture-router-transition-start.ts +33 -0
- package/src/client.ts +4 -0
- package/src/copy-config-files.test.ts +250 -16
- package/src/copy-config-files.ts +117 -34
- package/src/edge.ts +12 -1
- package/src/flush.ts +58 -0
- package/src/index.ts +7 -2
- package/src/insights-instrumentation.ts +104 -11
- package/src/insights.test.ts +192 -0
- package/src/insights.ts +225 -0
- package/src/setup.test.ts +214 -0
- package/src/setup.ts +172 -0
- package/src/source-maps.test.ts +803 -0
- package/src/source-maps.ts +515 -0
- package/src/types.ts +38 -21
- package/templates/_error.js +14 -10
- package/templates/_error_app_router.js +1 -1
- package/templates/_error_app_router.tsx +1 -1
- package/templates/honeybadger.server.config.js +5 -16
- package/templates/instrumentation-client.js +21 -0
- package/templates/instrumentation.js +29 -0
- package/dist/webpack.d.ts +0 -3
- package/dist/with-honeybadger.d.ts +0 -32
- package/dist/with-honeybadger.test.d.ts +0 -2
- package/src/webpack.ts +0 -228
- package/src/with-honeybadger.test.ts +0 -527
- package/src/with-honeybadger.ts +0 -286
- package/templates/honeybadger.browser.config.js +0 -13
- package/templates/honeybadger.edge.config.js +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"honeybadger-nextjs.esm.js","sources":["../../build/webpack.js","../../build/insights-instrumentation.js","../../build/with-honeybadger.js"],"sourcesContent":["import fs from 'fs';\nimport path from 'path';\nimport HoneybadgerSourceMapPlugin from '@honeybadger-io/webpack';\nconst URL_DOCS_SOURCE_MAPS_UPLOAD = 'https://docs.honeybadger.io/lib/javascript/integration/nextjs/#source-map-upload-and-tracking-deploys';\nlet _silent = true;\nfunction log(type, msg) {\n if (['error', 'warn'].includes(type) || !_silent) {\n console[type]('[HoneybadgerNextJs]', msg);\n }\n}\nfunction shouldUploadSourceMaps(honeybadgerNextJsConfig, context) {\n const { dev } = context;\n if (honeybadgerNextJsConfig.disableSourceMapUpload) {\n return false;\n }\n if (!honeybadgerNextJsConfig.webpackPluginOptions || !honeybadgerNextJsConfig.webpackPluginOptions.apiKey) {\n log('warn', `skipping source map upload; here's how to enable: ${URL_DOCS_SOURCE_MAPS_UPLOAD}`);\n return false;\n }\n if (dev || process.env.NODE_ENV === 'development') {\n return false;\n }\n return true;\n}\nfunction mergeWithExistingWebpackConfig(nextJsWebpackConfig, honeybadgerNextJsConfig) {\n return function webpackFunctionMergedWithHb(webpackConfig, context) {\n const { isServer, dir: projectDir, nextRuntime } = context;\n const configType = isServer ? (nextRuntime === 'edge' ? 'edge' : 'server') : 'browser';\n log('debug', `reached webpackFunctionMergedWithHb isServer[${isServer}] configType[${configType}]`);\n let result = { ...webpackConfig };\n if (typeof nextJsWebpackConfig === 'function') {\n result = nextJsWebpackConfig(result, context);\n }\n const originalEntry = result.entry;\n result.entry = async () => injectHoneybadgerConfigToEntry(originalEntry, projectDir, configType);\n if (shouldUploadSourceMaps(honeybadgerNextJsConfig, context)) {\n // `result.devtool` must be 'hidden-source-map' or 'source-map' to properly pass sourcemaps.\n // Next.js uses regular `source-map` which doesnt pass its sourcemaps to Webpack.\n // https://github.com/vercel/next.js/blob/89ec21ed686dd79a5770b5c669abaff8f55d8fef/packages/next/build/webpack/config/blocks/base.ts#L40\n // Use the hidden-source-map option when you don't want the source maps to be\n // publicly available on the servers, only to the error reporting\n result.devtool = 'hidden-source-map';\n if (!result.plugins) {\n result.plugins = [];\n }\n const options = getWebpackPluginOptions(honeybadgerNextJsConfig);\n if (options) {\n result.plugins.push(new HoneybadgerSourceMapPlugin(options));\n }\n }\n return result;\n };\n}\nasync function injectHoneybadgerConfigToEntry(originalEntry, projectDir, configType) {\n const result = typeof originalEntry === 'function' ? await originalEntry() : { ...originalEntry };\n const hbConfigFile = getHoneybadgerConfigFile(projectDir, configType);\n if (!hbConfigFile) {\n return result;\n }\n const hbConfigFileRelativePath = `./${hbConfigFile}`;\n if (!Object.keys(result).length) {\n log('debug', `no entry points for configType[${configType}]`);\n }\n for (const entryName in result) {\n addHoneybadgerConfigToEntry(result, entryName, hbConfigFileRelativePath, configType);\n }\n return result;\n}\nfunction addHoneybadgerConfigToEntry(entry, entryName, hbConfigFile, configType) {\n log('debug', `adding entry[${entryName}] to configType[${configType}]`);\n switch (configType) {\n case 'server':\n if (!entryName.startsWith('pages/')) {\n return;\n }\n break;\n case 'browser':\n if (!['pages/_app', 'main-app'].includes(entryName)) {\n return;\n }\n break;\n case 'edge':\n // nothing?\n break;\n }\n const currentEntryPoint = entry[entryName];\n let newEntryPoint = currentEntryPoint;\n if (typeof currentEntryPoint === 'string') {\n newEntryPoint = [hbConfigFile, currentEntryPoint];\n }\n else if (Array.isArray(currentEntryPoint)) {\n newEntryPoint = [hbConfigFile, ...currentEntryPoint];\n } // descriptor object (webpack 5+)\n else if (typeof currentEntryPoint === 'object' && currentEntryPoint && 'import' in currentEntryPoint) {\n const currentImportValue = currentEntryPoint['import'];\n const newImportValue = [hbConfigFile];\n if (typeof currentImportValue === 'string') {\n newImportValue.push(currentImportValue);\n }\n else {\n newImportValue.push(...(currentImportValue));\n }\n newEntryPoint = {\n ...currentEntryPoint,\n import: newImportValue,\n };\n }\n else {\n log('error', 'Could not inject Honeybadger config to entry point: ' + JSON.stringify(currentEntryPoint, null, 2));\n }\n entry[entryName] = newEntryPoint;\n}\nfunction getHoneybadgerConfigFile(projectDir, configType) {\n const possibilities = [`honeybadger.${configType}.config.ts`, `honeybadger.${configType}.config.js`];\n for (const filename of possibilities) {\n if (fs.existsSync(path.resolve(projectDir, filename))) {\n return filename;\n }\n }\n log('debug', `could not find config file in ${projectDir} for ${configType}`);\n return null;\n}\nfunction getWebpackPluginOptions(honeybadgerNextJsConfig) {\n var _a, _b, _c;\n const apiKey = ((_a = honeybadgerNextJsConfig.webpackPluginOptions) === null || _a === void 0 ? void 0 : _a.apiKey) || process.env.NEXT_PUBLIC_HONEYBADGER_API_KEY;\n const assetsUrl = ((_b = honeybadgerNextJsConfig.webpackPluginOptions) === null || _b === void 0 ? void 0 : _b.assetsUrl) || process.env.NEXT_PUBLIC_HONEYBADGER_ASSETS_URL;\n if (!apiKey || !assetsUrl) {\n log('error', 'Missing Honeybadger required configuration for webpack plugin. Source maps will not be uploaded to Honeybadger.');\n return null;\n }\n return {\n ...honeybadgerNextJsConfig.webpackPluginOptions,\n apiKey,\n assetsUrl,\n revision: ((_c = honeybadgerNextJsConfig.webpackPluginOptions) === null || _c === void 0 ? void 0 : _c.revision) || process.env.NEXT_PUBLIC_HONEYBADGER_REVISION,\n silent: _silent,\n };\n}\nfunction getNextJsVersionInstalled() {\n var _a;\n try {\n return (_a = require('next/package.json').version) === null || _a === void 0 ? void 0 : _a.split('.');\n }\n catch (e) {\n return null;\n }\n}\n/**\n * NextJs will report a warning if the `serverExternalPackages` option is not present.\n * This is because @honeybadger-io/js will try to require configuration files dynamically (https://github.com/honeybadger-io/honeybadger-js/pull/1268).\n *\n * First reported here: https://github.com/honeybadger-io/honeybadger-js/issues/1351\n */\nfunction addServerExternalPackagesOption(config) {\n var _a, _b;\n // this should be available in the upcoming version of Next.js (14.3.0)\n if (config.serverExternalPackages && Array.isArray(config.serverExternalPackages)) {\n log('debug', 'adding @honeybadger-io/js to serverExternalPackages');\n config.serverExternalPackages.push('@honeybadger-io/js');\n return;\n }\n if (((_a = config.experimental) === null || _a === void 0 ? void 0 : _a.serverComponentsExternalPackages) && Array.isArray((_b = config.experimental) === null || _b === void 0 ? void 0 : _b.serverComponentsExternalPackages)) {\n log('debug', 'adding @honeybadger-io/js to experimental.serverComponentsExternalPackages');\n config.experimental.serverComponentsExternalPackages.push('@honeybadger-io/js');\n return;\n }\n const nextJsVersion = getNextJsVersionInstalled();\n if (nextJsVersion) {\n if ((+nextJsVersion[0] === 14 && +nextJsVersion[1] >= 3) || +nextJsVersion[0] > 14) {\n log('debug', 'adding serverExternalPackages option with value [\"@honeybadger-io/js\"]');\n config.serverExternalPackages = ['@honeybadger-io/js'];\n }\n else {\n log('debug', 'adding experimental.serverComponentsExternalPackages option with value [\"@honeybadger-io/js\"]');\n if (!config.experimental) {\n config.experimental = {};\n }\n config.experimental.serverComponentsExternalPackages = ['@honeybadger-io/js'];\n }\n }\n}\nexport function setupHoneybadger(config, honeybadgerNextJsConfig) {\n var _a;\n if (!honeybadgerNextJsConfig) {\n honeybadgerNextJsConfig = {\n silent: true,\n disableSourceMapUpload: false,\n };\n }\n _silent = (_a = honeybadgerNextJsConfig.silent) !== null && _a !== void 0 ? _a : true;\n addServerExternalPackagesOption(config);\n return {\n ...config,\n webpack: mergeWithExistingWebpackConfig(config.webpack, honeybadgerNextJsConfig)\n };\n}\n//# sourceMappingURL=webpack.js.map","import Honeybadger from '@honeybadger-io/js';\n/**\n * Edge-safe equivalents of the inbound instrumentation helpers in\n * `@honeybadger-io/js` (src/server/instrumentation/http_event.ts). They are\n * duplicated here because this module must also load on the edge runtime where\n * Node builtins (the `crypto` module, `process.hrtime`) are unavailable. Keep\n * the header names and the `request_id` / `correlation_id` contract in sync\n * with that file.\n *\n * Both request shapes Next.js uses are supported: the `*RequestEventContext` /\n * `*RequestEvent` pairs come in a web-`Headers`/`Request` variant (App Router\n * route handlers and middleware) and a Node-bag variant (Pages Router API\n * routes, which only ever run on the Node runtime).\n */\nfunction generateId() {\n const webCrypto = globalThis.crypto;\n if (webCrypto && typeof webCrypto.randomUUID === 'function') {\n try {\n return webCrypto.randomUUID();\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // fall through to manual generation\n }\n }\n // v4-shaped, not crypto-quality. Acceptable since this is a correlation id,\n // not a security token.\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (ch) => {\n const r = (Math.random() * 16) | 0;\n const v = ch === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nfunction readHeader(headers, name) {\n const value = headers.get(name);\n if (typeof value !== 'string') {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length ? trimmed : undefined;\n}\nfunction readNodeHeader(headers, name) {\n if (!headers) {\n return undefined;\n }\n const lower = name.toLowerCase();\n let value = headers[lower];\n if (value === undefined) {\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === lower) {\n value = headers[key];\n break;\n }\n }\n }\n if (Array.isArray(value)) {\n value = value[0];\n }\n if (typeof value !== 'string') {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length ? trimmed : undefined;\n}\n// Shared id precedence. Kept in one place (rather than once per request shape)\n// so the header-name contract documented above is only spelled out once.\nfunction seedIds(read) {\n var _a, _b, _c, _d;\n const requestId = (_b = (_a = read('x-request-id')) !== null && _a !== void 0 ? _a : read('request-id')) !== null && _b !== void 0 ? _b : generateId();\n const correlationId = (_d = (_c = read('x-correlation-id')) !== null && _c !== void 0 ? _c : read('x-amzn-trace-id')) !== null && _d !== void 0 ? _d : requestId;\n return { request_id: requestId, correlation_id: correlationId };\n}\n// App Router / middleware: headers are a web `Headers` instance.\nexport function seedRequestEventContext(headers) {\n return seedIds((name) => readHeader(headers, name));\n}\n// Pages Router: headers are a Node bag (Pages routes are Node-only, never edge).\nexport function seedNodeRequestEventContext(headers) {\n return seedIds((name) => readNodeHeader(headers, name));\n}\nexport function now() {\n return typeof performance !== 'undefined' ? performance.now() : Date.now();\n}\n// Mirrors Util.resolveInsights from @honeybadger-io/core: the master gate and\n// the per-source flag must both be on.\nexport function insightsHttpEnabled() {\n const insights = Honeybadger.config.insights;\n return (insights === null || insights === void 0 ? void 0 : insights.enabled) === true && (insights === null || insights === void 0 ? void 0 : insights.http) === true;\n}\n// The ids are embedded directly in the payload (instead of relying on the\n// store's eventContext merge) so the event carries them even on the edge\n// runtime, where there is no per-request store isolation. On the Node.js\n// runtime they match the seeded event context, so embedding is a no-op.\nfunction emitHandledEvent(method, path, status, start, ids) {\n const payload = {\n method,\n duration: Math.round(now() - start),\n ...ids,\n };\n if (typeof path === 'string') {\n payload.path = path;\n }\n if (typeof status === 'number') {\n payload.status = status;\n }\n Honeybadger.event('request.handled', payload);\n}\n// App Router / middleware: `req.url` is absolute, so parse out the pathname.\nexport function emitRequestEvent(req, status, start, ids) {\n let path;\n try {\n path = new URL(req.url).pathname;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // relative or malformed URL — leave path unset\n }\n emitHandledEvent(req.method, path, status, start, ids);\n}\n// Pages Router: `req.url` is a relative path that may carry a query string.\nexport function emitNodeRequestEvent(req, status, start, ids) {\n const path = typeof req.url === 'string' ? req.url.split('?')[0] : undefined;\n emitHandledEvent(req.method, path, status, start, ids);\n}\n//# sourceMappingURL=insights-instrumentation.js.map","import Honeybadger from '@honeybadger-io/js';\nimport * as nextServer from 'next/server';\nimport { emitNodeRequestEvent, emitRequestEvent, insightsHttpEnabled, now, seedNodeRequestEventContext, seedRequestEventContext, } from './insights-instrumentation';\n/**\n * The `waitUntil` primitive the hosting platform injects per request. Next.js\n * resolves `after()` through this same accessor, and it is the only channel\n * available in Pages Router API routes, which are invoked as `(req, res)` with\n * no context argument to read it from.\n */\nfunction requestContextWaitUntil() {\n var _a, _b;\n const context = globalThis[Symbol.for('@next/request-context')];\n const waitUntil = (_b = (_a = context === null || context === void 0 ? void 0 : context.get) === null || _a === void 0 ? void 0 : _a.call(context)) === null || _b === void 0 ? void 0 : _b.waitUntil;\n return typeof waitUntil === 'function' ? waitUntil : undefined;\n}\n/**\n * Middleware receives a `NextFetchEvent` as its second argument. Duck-typed\n * rather than `instanceof` so the edge bundle needs no runtime import, and\n * bound because `waitUntil` is a class method that collects into the event.\n */\nfunction eventWaitUntil(event) {\n const waitUntil = event === null || event === void 0 ? void 0 : event.waitUntil;\n return typeof waitUntil === 'function' ? waitUntil.bind(event) : undefined;\n}\n/**\n * Ensure Insights events are delivered before the serverless/edge runtime\n * freezes, without delaying the response where the runtime lets us avoid it.\n *\n * In order of preference: Next.js `after()` (stable in 15.1, App Router only —\n * it needs App Router request context, so Pages Router must not call it), then\n * a `waitUntil` from the middleware event or the platform request context,\n * then a blocking `flushAsync()` when the runtime offers neither. Blocking is\n * correct in that last case: no `waitUntil` means nothing is going to freeze\n * the invocation out from under us.\n *\n * Delivery failures are logged by the events worker and must not break the handler.\n */\nfunction scheduleFlush(options = {}) {\n var _a;\n const flush = () => Honeybadger.flushAsync().catch(() => { });\n if (options.useAfter) {\n const after = nextServer.after;\n if (typeof after === 'function') {\n // Exported but still refusable: `after()` throws outside a supported\n // context. Fall through to the remaining strategies rather than failing\n // the request.\n try {\n after(flush);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // try waitUntil / blocking flush below\n }\n }\n }\n const waitUntil = (_a = options.waitUntil) !== null && _a !== void 0 ? _a : requestContextWaitUntil();\n if (waitUntil) {\n waitUntil(flush());\n return;\n }\n return flush();\n}\nfunction configure(overrides) {\n var _a;\n if (((_a = Honeybadger.config.apiKey) === null || _a === void 0 ? void 0 : _a.length) > 0) {\n return;\n }\n let projectRoot = undefined;\n try {\n // not available on edge runtime\n projectRoot = process.cwd();\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // do nothing\n }\n Honeybadger\n .configure({\n apiKey: process.env.NEXT_PUBLIC_HONEYBADGER_API_KEY,\n environment: process.env.NEXT_PUBLIC_VERCEL_ENV || process.env.VERCEL_ENV || process.env.NODE_ENV,\n revision: process.env.NEXT_PUBLIC_HONEYBADGER_REVISION,\n projectRoot: 'webpack://_N_E/./',\n ...overrides,\n })\n .beforeNotify((notice) => {\n if (!projectRoot) {\n return;\n }\n notice === null || notice === void 0 ? void 0 : notice.backtrace.forEach((line) => {\n if (line.file) {\n line.file = line.file.replace(`${projectRoot}/.next/server`, `${process.env.NEXT_PUBLIC_HONEYBADGER_ASSETS_URL}/..`);\n }\n return line;\n });\n });\n}\n/**\n * Next.js uses thrown errors for control flow: `redirect()`, `notFound()`,\n * `forbidden()` and `unauthorized()` all throw an error carrying a `digest`\n * string (`NEXT_REDIRECT;...`, `NEXT_NOT_FOUND`, `NEXT_HTTP_ERROR_FALLBACK;...`).\n * These are not real failures — the framework catches them upstream to produce\n * the redirect/404/etc. — so we must let them propagate without reporting them,\n * otherwise every redirect shows up as an error in Honeybadger.\n *\n * We match on the `NEXT_` prefix rather than an exhaustive list so that any\n * present or future framework control-flow digest is covered. This is safe:\n * genuine errors that React tags with a `digest` use an opaque hash, and other\n * Next.js bailout signals (e.g. `BAILOUT_TO_CLIENT_SIDE_RENDERING`,\n * `DYNAMIC_SERVER_USAGE`) are not `NEXT_`-prefixed, so neither is skipped.\n */\nfunction isNextControlFlowError(error) {\n const digest = error === null || error === void 0 ? void 0 : error.digest;\n return typeof digest === 'string' && digest.startsWith('NEXT_');\n}\n/**\n * Detects a Pages Router API invocation: `(req, res)` where `res` is a Node\n * `ServerResponse`. We branch on this structurally because — unlike an App\n * Router route handler — there is no returned `Response` to read the status\n * from; it lives on `res.statusCode`.\n */\nfunction isPagesApiInvocation(args) {\n const req = args[0];\n const res = args[1];\n return (!!req && typeof req.headers === 'object' && req.headers !== null &&\n !!res && typeof res.statusCode === 'number' && typeof res.end === 'function');\n}\n/**\n * App Router route handlers and middleware: a web `Request`/`NextRequest` in, a\n * `Response`/`NextResponse` out. The status comes from the returned response.\n *\n * `waitUntil` is present for middleware (from its `NextFetchEvent`); route\n * handlers get `{ params }` as their second argument and rely on `after()`.\n */\nasync function handleAppRouterRequest(call, req, canIsolate, waitUntil) {\n const ids = seedRequestEventContext(req.headers);\n if (canIsolate) {\n Honeybadger.setEventContext(ids);\n }\n const start = insightsHttpEnabled() ? now() : null;\n try {\n const response = await call();\n if (start !== null) {\n emitRequestEvent(req, response === null || response === void 0 ? void 0 : response.status, start, ids);\n await scheduleFlush({ useAfter: true, waitUntil });\n }\n return response;\n }\n catch (error) {\n if (isNextControlFlowError(error)) {\n throw error;\n }\n if (start !== null) {\n emitRequestEvent(req, 500, start, ids);\n await scheduleFlush({ useAfter: true, waitUntil });\n }\n await Honeybadger.notifyAsync(error);\n throw error;\n }\n}\n/**\n * Pages Router API routes: a Node `req`/`res` pair. The handler writes to `res`\n * and returns nothing meaningful, so the final status is read from\n * `res.statusCode` once it resolves.\n */\nasync function handlePagesApiRequest(call, req, res, canIsolate) {\n const ids = seedNodeRequestEventContext(req.headers);\n if (canIsolate) {\n Honeybadger.setEventContext(ids);\n }\n const start = insightsHttpEnabled() ? now() : null;\n try {\n const result = await call();\n if (start !== null) {\n emitNodeRequestEvent(req, res.statusCode, start, ids);\n // No after() here: Pages Router lacks the App Router request context it\n // needs. scheduleFlush falls through to the platform waitUntil instead.\n await scheduleFlush({ useAfter: false });\n }\n return result;\n }\n catch (error) {\n if (isNextControlFlowError(error)) {\n throw error;\n }\n if (start !== null) {\n emitNodeRequestEvent(req, 500, start, ids);\n await scheduleFlush({ useAfter: false });\n }\n await Honeybadger.notifyAsync(error);\n throw error;\n }\n}\n/**\n * Unrecognised invocation shape: still report errors, but emit no insights\n * event since we can't reliably read the request.\n */\nasync function handleUninstrumented(call) {\n try {\n return await call();\n }\n catch (error) {\n if (isNextControlFlowError(error)) {\n throw error;\n }\n await Honeybadger.notifyAsync(error);\n throw error;\n }\n}\nexport function withHoneybadger(handler, config) {\n configure(config);\n return new Proxy(handler, {\n apply: (target, thisArg, args) => {\n const canIsolate = typeof Honeybadger.run === 'function';\n const call = () => Reflect.apply(target, thisArg, args);\n const invoke = () => {\n // App Router / middleware first: a web Request as the first argument.\n if (typeof Request !== 'undefined' && args[0] instanceof Request) {\n return handleAppRouterRequest(call, args[0], canIsolate, eventWaitUntil(args[1]));\n }\n // Pages Router API route: a Node req/res pair.\n if (isPagesApiInvocation(args)) {\n return handlePagesApiRequest(call, args[0], args[1], canIsolate);\n }\n return handleUninstrumented(call);\n };\n return canIsolate ? Honeybadger.run(invoke) : invoke();\n },\n });\n}\n//# sourceMappingURL=with-honeybadger.js.map"],"names":[],"mappings":";;;;;;AAGA,MAAM,2BAA2B,GAAG,uGAAuG,CAAC;AAC5I,IAAI,OAAO,GAAG,IAAI,CAAC;AACnB,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;AACxB,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;AACtD,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;AAClD,KAAK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,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC;AACnE,SAAS;AACT,KAAK,CAAC,CAAC;AACP;;;;"}
|
|
1
|
+
{"version":3,"file":"honeybadger-nextjs.esm.js","sources":["../../build/source-maps.js","../../build/setup.js","../../build/flush.js","../../build/insights-instrumentation.js","../../build/capture-request-error.js","../../build/capture-router-transition-start.js","../../build/insights.js"],"sourcesContent":["import fs from 'fs';\nimport os from 'os';\nimport path from 'path';\nimport picomatch from 'picomatch';\n/**\n * Loads plugin-core on demand, never at module scope.\n *\n * Its module body runs `fetchRetry(require('node-fetch'))` as a side effect, which throws\n * `ArgumentError: fetch must be a function` inside the Next.js server runtime. This module\n * shares a barrel with the runtime instrumentation exports, so a top-level import here\n * would break `instrumentation.ts` for every app. plugin-core is a rollup external, so this\n * stays a real deferred require in both the CJS and ESM bundles.\n */\nfunction loadPluginCore() {\n return import('@honeybadger-io/plugin-core');\n}\n/**\n * The build output directory Next.js serves over HTTP, relative to `distDir`. `.next/static`\n * is published at `/_next/static`; everything else in `distDir` is not served.\n */\nconst BROWSER_OUTPUT_DIR = 'static';\n/**\n * The directories inside `distDir` whose JavaScript is actually shipped, and so the only\n * ones worth collecting maps from. `distDir` also holds build tooling — `build/chunks`,\n * `cache`, `required-server-files.js` — and a `standalone` copy of the server when that\n * output mode is on. Walking all of it uploads maps under a `minified_url` no request can\n * ever produce.\n */\nconst OUTPUT_DIRS = [BROWSER_OUTPUT_DIR, 'server'];\nfunction log(type, silent, msg) {\n if (['error', 'warn'].includes(type) || !silent) {\n console[type]('[HoneybadgerNextJs]', msg);\n }\n}\n/**\n * Whether the project has configured source map upload.\n *\n * Separate from `resolveUploadOptions` because `withHoneybadgerConfig` needs the answer\n * while building the config, and must not emit the \"not configured\" warning there — the\n * hook will do that once, at build time.\n */\nexport function isSourceMapUploadConfigured(honeybadgerNextJsConfig = {}) {\n if (honeybadgerNextJsConfig.disableSourceMapUpload) {\n return false;\n }\n const apiKey = honeybadgerNextJsConfig.apiKey || process.env.NEXT_PUBLIC_HONEYBADGER_API_KEY;\n const assetsUrl = honeybadgerNextJsConfig.assetsUrl || process.env.NEXT_PUBLIC_HONEYBADGER_ASSETS_URL;\n return Boolean(apiKey && assetsUrl);\n}\n/**\n * Resolves the upload options, falling back to the same environment variables the\n * configuration templates use.\n *\n * Returns `null` rather than throwing when the project has not configured source map\n * upload. `cleanOptions` throws on a missing `apiKey`/`assetsUrl`, and Next.js re-throws\n * whatever this hook throws — so validating eagerly would fail the build of every app\n * that simply does not use this feature.\n */\nexport async function resolveUploadOptions(honeybadgerNextJsConfig = {}) {\n var _a;\n const silent = (_a = honeybadgerNextJsConfig.silent) !== null && _a !== void 0 ? _a : true;\n if (honeybadgerNextJsConfig.disableSourceMapUpload) {\n log('debug', silent, 'source map upload disabled');\n return null;\n }\n // `disableSourceMapUpload` is this package's own switch, handled above; everything else\n // on the config is a plugin-core option and passes straight through.\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { disableSourceMapUpload, ...provided } = honeybadgerNextJsConfig;\n const apiKey = provided.apiKey || process.env.NEXT_PUBLIC_HONEYBADGER_API_KEY;\n const assetsUrl = provided.assetsUrl || process.env.NEXT_PUBLIC_HONEYBADGER_ASSETS_URL;\n if (!apiKey || !assetsUrl) {\n log('warn', silent, 'skipping source map upload; set apiKey and assetsUrl to enable it');\n return null;\n }\n // `cleanOptions` merges as `{ ...defaults, ...options }`, so a key present with an\n // `undefined` value overwrites the default rather than falling back to it. An unset\n // revision would upload as `undefined` instead of `main`, and a fault whose revision\n // does not match its source map is never symbolicated — so drop empty values instead\n // of passing them through.\n const { cleanOptions } = await loadPluginCore();\n return cleanOptions(withoutUndefined({\n ...provided,\n apiKey,\n assetsUrl,\n revision: provided.revision || process.env.NEXT_PUBLIC_HONEYBADGER_REVISION,\n silent,\n }));\n}\nfunction withoutUndefined(options) {\n return Object.fromEntries(Object.entries(options).filter(([, value]) => value !== undefined));\n}\n// Mirrors plugin-core's DEFAULT_DEVELOPMENT_ENVIRONMENTS. Duplicated so a development\n// build can be recognised before plugin-core is loaded — see uploadSourceMapsAfterBuild.\nconst DEFAULT_DEVELOPMENT_ENVIRONMENTS = ['dev', 'development', 'test'];\nfunction isDevEnv(developmentEnvironments) {\n if (!process.env.NODE_ENV) {\n return false;\n }\n return developmentEnvironments.includes(process.env.NODE_ENV);\n}\nasync function walk(dir, onFile) {\n let entries;\n try {\n entries = await fs.promises.readdir(dir, { withFileTypes: true });\n }\n catch (error) {\n // A build output directory that isn't there is not an error worth failing on — the\n // server tree does not exist unless `experimental.serverSourceMaps` is on. Anything\n // else (permissions, I/O) would silently shrink the upload to whatever happened to be\n // readable, so let it propagate and be governed by `ignoreErrors`.\n if (error.code === 'ENOENT') {\n return;\n }\n throw error;\n }\n for (const entry of entries) {\n const entryPath = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n await walk(entryPath, onFile);\n }\n else if (entry.isFile()) {\n onFile(entryPath);\n }\n }\n}\n/**\n * A source map is only worth uploading when it carries the original sources. Next.js\n * emits maps without `sourcesContent` for some outputs, and those symbolicate to\n * nothing. Same check the rollup and esbuild plugins apply.\n */\nasync function hasSourcesContent(sourcemapFilePath) {\n try {\n const contents = await fs.promises.readFile(sourcemapFilePath, 'utf8');\n const parsed = JSON.parse(contents);\n return Array.isArray(parsed.sourcesContent) && parsed.sourcesContent.length > 0;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n return false;\n }\n}\n// Enough to reach the `sourceMappingURL` comment, which is the last line of a built file.\nconst SOURCE_MAPPING_URL_TAIL_BYTES = 2048;\n/**\n * The source map a built JavaScript file points at, or `null` when it has none.\n *\n * Resolved from the file's own `sourceMappingURL` comment rather than by assuming the map\n * sits beside it as `<name>.js.map`. That sibling convention is webpack's; Turbopack gives\n * the map an independent hash — `1mfl5gjk9763d.js` points at `33ri1p-shrphb.js.map`.\n *\n * Only the tail of the file is read, since the comment is always its last line.\n */\nasync function locateSourcemap(jsFilePath) {\n var _a;\n let tail;\n try {\n const handle = await fs.promises.open(jsFilePath, 'r');\n try {\n const { size } = await handle.stat();\n const length = Math.min(size, SOURCE_MAPPING_URL_TAIL_BYTES);\n const buffer = Buffer.alloc(length);\n await handle.read(buffer, 0, length, size - length);\n tail = buffer.toString('utf8');\n }\n finally {\n await handle.close();\n }\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n return null;\n }\n // The last comment wins, per the source map spec. No Next.js chunk currently carries\n // two, but a bundled library that mentions `sourceMappingURL` in its tail would\n // otherwise mispair the map.\n const matches = [...tail.matchAll(/[#@]\\s*sourceMappingURL=(\\S+)/g)];\n const url = (_a = matches.at(-1)) === null || _a === void 0 ? void 0 : _a[1];\n // No map, or an inline `data:` map, which there is nothing to upload for.\n if (!url || url.startsWith('data:')) {\n return null;\n }\n // `decodeURIComponent` throws on malformed escapes such as `bad%.map`. Scoped to just\n // the decode, because letting it escape would abandon the whole build's upload over one\n // unreadable footer rather than skipping that single file.\n let decodedUrl;\n try {\n decodedUrl = decodeURIComponent(url);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n return null;\n }\n const sourcemapFilePath = path.resolve(path.dirname(jsFilePath), decodedUrl);\n return fs.existsSync(sourcemapFilePath) ? sourcemapFilePath : null;\n}\n/**\n * Pairs each built `.js` file with the source map it declares.\n *\n * `jsFilename` is the path relative to `distDir`, because that is what `assetsUrl`\n * addresses: the configuration templates point it at `<origin>/_next`, and `.next/x`\n * is served at `/_next/x`. `uploadSourcemap` builds `minified_url` by joining the two.\n *\n * Only `static/` and `server/` are walked — see `OUTPUT_DIRS`. Server maps exist only when\n * `experimental.serverSourceMaps` is on, which `withHoneybadgerConfig` enables alongside\n * upload. Server chunks are not served over HTTP, so whether their frames match the\n * uploaded `minified_url` depends on the runtime path rewriting tracked in #1602 — but\n * not uploading them at all guarantees server frames stay minified, which is the defect\n * that issue reports.\n */\nexport async function collectSourcemaps(distDir, ignorePaths = []) {\n const jsFilePaths = [];\n for (const outputDir of OUTPUT_DIRS) {\n await walk(path.join(distDir, outputDir), (filePath) => {\n if (filePath.endsWith('.js')) {\n jsFilePaths.push(filePath);\n }\n });\n }\n const collected = [];\n for (const jsFilePath of jsFilePaths) {\n if (picomatch.isMatch(jsFilePath, ignorePaths, { basename: true })) {\n continue;\n }\n const sourcemapFilePath = await locateSourcemap(jsFilePath);\n if (!sourcemapFilePath) {\n continue;\n }\n if (!await hasSourcesContent(sourcemapFilePath)) {\n continue;\n }\n // Posix separators: these become URL paths.\n const jsFilename = path.relative(distDir, jsFilePath).split(path.sep).join('/');\n collected.push({\n sourcemapFilename: path.relative(distDir, sourcemapFilePath).split(path.sep).join('/'),\n sourcemapFilePath,\n jsFilename,\n jsFilePath,\n });\n }\n return collected;\n}\n/**\n * Bundler URL schemes that appear in a map's `sources`.\n *\n * Turbopack writes `turbopack:///[project]/app/page.tsx`; webpack writes\n * `webpack://_N_E/./app/page.tsx` or `webpack:///./app/page.tsx`.\n */\nconst SOURCE_SCHEME_PREFIXES = [\n /^turbopack:\\/\\/\\/\\[[^\\]]+\\]\\//,\n /^webpack:\\/\\/[^/]*\\/(\\.\\/)?/,\n];\nfunction normalizeSource(source) {\n for (const prefix of SOURCE_SCHEME_PREFIXES) {\n const normalized = source.replace(prefix, '');\n if (normalized !== source) {\n return normalized;\n }\n }\n return source;\n}\n/**\n * Rewrites each map's `sources` to project-relative paths, in a throwaway copy.\n *\n * Honeybadger decides whether a mapped frame is *your* code by testing the resolved source\n * against the notice's `projectRoot`, which the browser client defaults to the page origin.\n * A source still carrying its bundler scheme never matches, so the frame is treated as\n * library code and the fault surfaces the next frame instead — for a React app, an unmapped\n * framework chunk. Stripping the scheme leaves a relative path, which Honeybadger resolves\n * against the minified URL and therefore under the origin.\n *\n * Done here rather than by asking users to set `projectRoot` to a bundler-specific prefix,\n * because that value differs between Turbopack and webpack and cannot be chosen correctly\n * from client config.\n *\n * The originals on disk are untouched: Next.js reads the server maps itself.\n */\nasync function withNormalizedSources(sourcemaps) {\n const unchanged = { sourcemaps, cleanup: async () => undefined };\n if (sourcemaps.length === 0) {\n return unchanged;\n }\n let tempDir;\n try {\n tempDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), 'honeybadger-sourcemaps-'));\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // Uploading unnormalized maps beats not uploading at all.\n return unchanged;\n }\n const cleanup = () => fs.promises.rm(tempDir, { recursive: true, force: true });\n const normalized = [];\n for (const [index, sourcemap] of sourcemaps.entries()) {\n try {\n const parsed = JSON.parse(await fs.promises.readFile(sourcemap.sourcemapFilePath, 'utf8'));\n const sources = parsed.sources;\n if (!Array.isArray(sources) || !sources.some((source) => normalizeSource(String(source)) !== source)) {\n normalized.push(sourcemap);\n continue;\n }\n parsed.sources = sources.map((source) => normalizeSource(String(source)));\n // Named by position, so two maps can never collide in the temp directory.\n const copyPath = path.join(tempDir, `${index}.js.map`);\n await fs.promises.writeFile(copyPath, JSON.stringify(parsed));\n normalized.push({ ...sourcemap, sourcemapFilePath: copyPath });\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // A map we cannot rewrite is still worth uploading as it is.\n normalized.push(sourcemap);\n }\n }\n return { sourcemaps: normalized, cleanup };\n}\n/**\n * Removes the *browser* source map files after they have been uploaded.\n *\n * Only for maps this package caused to be generated. `productionBrowserSourceMaps`\n * publishes what it generates and Next.js has no hidden-source-map equivalent, so deleting\n * after upload is what keeps them out of visitors' hands.\n *\n * Server maps are deliberately left alone. `.next/server` is not served, so there is no\n * exposure to undo, and Next.js reads those maps itself when it formats server-side stack\n * traces — deleting them would degrade the project's own logs for no benefit.\n *\n * The `sourceMappingURL` comments in the emitted JavaScript are left behind, so a browser\n * that goes looking will get a 404 rather than the source.\n */\nasync function deleteBrowserSourcemapFiles(distDir, silent) {\n // Deliberately every `.js.map` under `static`, not just the ones that were uploaded.\n // `collectSourcemaps` drops maps that are ignored, malformed, unpaired, or missing\n // `sourcesContent` — all of which Next.js still serves. Deleting only what we uploaded\n // would leave exactly those behind, publicly readable, because of an option we turned on.\n const mapFilePaths = [];\n await walk(path.join(distDir, BROWSER_OUTPUT_DIR), (filePath) => {\n if (filePath.endsWith('.js.map')) {\n mapFilePaths.push(filePath);\n }\n });\n let deleted = 0;\n for (const mapFilePath of mapFilePaths) {\n try {\n await fs.promises.unlink(mapFilePath);\n deleted++;\n }\n catch (error) {\n // Loud, and not gated behind `silent`: a map we failed to remove is one this package\n // caused to be served. That is exposure, not cleanup noise.\n log('warn', silent, `could not delete ${path.relative(distDir, mapFilePath)}, so it will be served ` +\n `publicly: ${error.message}`);\n }\n }\n log('debug', silent, `deleted ${deleted} browser source map file(s) from the build output`);\n}\n/**\n * Uploads the build's source maps to Honeybadger.\n *\n * Registered by `withHoneybadgerConfig` on Next.js's `compiler.runAfterProductionCompile`\n * hook, which runs for both Turbopack and webpack builds.\n *\n * Next.js re-throws whatever this hook throws, which would fail the user's build, so a\n * failed upload is only allowed to propagate when `ignoreErrors` is off.\n */\nexport async function uploadSourceMapsAfterBuild(honeybadgerNextJsConfig, metadata, options = {}) {\n var _a, _b, _c;\n // Read from the raw config rather than the resolved options, because the error handling\n // below has to cover resolving them at all: `cleanOptions` can throw, and loading\n // plugin-core can fail outright. Doing that outside the try meant a failure there ignored\n // `ignoreErrors` and skipped the cleanup that keeps browser maps off the wire.\n const silent = (_a = honeybadgerNextJsConfig === null || honeybadgerNextJsConfig === void 0 ? void 0 : honeybadgerNextJsConfig.silent) !== null && _a !== void 0 ? _a : true;\n const ignoreErrors = (_b = honeybadgerNextJsConfig === null || honeybadgerNextJsConfig === void 0 ? void 0 : honeybadgerNextJsConfig.ignoreErrors) !== null && _b !== void 0 ? _b : false;\n // Outside the try/finally below: a build that never intended to upload also never enabled\n // the browser maps, so there is nothing of ours to clean up. Decided from the raw config\n // so it needs no plugin-core.\n const developmentEnvironments = (_c = honeybadgerNextJsConfig === null || honeybadgerNextJsConfig === void 0 ? void 0 : honeybadgerNextJsConfig.developmentEnvironments) !== null && _c !== void 0 ? _c : DEFAULT_DEVELOPMENT_ENVIRONMENTS;\n if (isDevEnv(developmentEnvironments)) {\n log('debug', silent, `skipping source map upload in ${process.env.NODE_ENV}`);\n return;\n }\n try {\n const uploadOptions = await resolveUploadOptions(honeybadgerNextJsConfig);\n if (!uploadOptions) {\n return;\n }\n const { uploadSourcemaps, sendDeployNotification } = await loadPluginCore();\n const sourcemaps = await collectSourcemaps(metadata.distDir, uploadOptions.ignorePaths);\n if (sourcemaps.length === 0) {\n // Upload is configured, so finding nothing means something is wrong — a `distDir`\n // that moved, or an `ignorePaths` that matches everything. Silence here would look\n // exactly like success.\n log('warn', silent, `found no source maps to upload in ${metadata.distDir}`);\n return;\n }\n const normalized = await withNormalizedSources(sourcemaps);\n try {\n await uploadSourcemaps(normalized.sourcemaps, uploadOptions);\n }\n finally {\n await normalized.cleanup();\n }\n // Only after maps actually went up. A failed upload already skips this by throwing, so\n // announcing a deploy for a build that uploaded nothing was the one inconsistent case —\n // and it reads as \"the maps for this revision are in place\" when they are not.\n if (uploadOptions.deploy) {\n await sendDeployNotification(uploadOptions);\n }\n }\n catch (error) {\n if (!ignoreErrors) {\n throw error;\n }\n log('error', silent, `source map upload failed: ${error.message}`);\n }\n finally {\n // Unconditionally, including after a failed upload. We enabled\n // `productionBrowserSourceMaps`, so these maps ship publicly unless something removes\n // them — and `ignoreErrors: true`, which the docs recommend so an outage cannot block a\n // deploy, would otherwise turn every failed upload into published source. Keeping them\n // to preserve \"the only copy\" is not worth that: a rebuild regenerates them, whereas a\n // deploy that served them cannot be recalled.\n if (options.deleteBrowserSourcemaps) {\n try {\n await deleteBrowserSourcemapFiles(metadata.distDir, silent);\n }\n catch (error) {\n // Never let cleanup mask the upload failure that is already propagating.\n log('warn', silent, `could not clean up browser source maps: ${error.message}`);\n }\n }\n }\n}\n//# sourceMappingURL=source-maps.js.map","import { isSourceMapUploadConfigured, uploadSourceMapsAfterBuild } from './source-maps';\nconst HONEYBADGER_JS_PACKAGE = '@honeybadger-io/js';\nlet _silent = true;\nfunction log(type, msg) {\n if (['error', 'warn'].includes(type) || !_silent) {\n console[type]('[HoneybadgerNextJs]', msg);\n }\n}\n/**\n * Next.js warns when a package that requires files dynamically is bundled into the\n * server build. @honeybadger-io/js does exactly that, so it has to be listed as an\n * external package.\n *\n * First reported in https://github.com/honeybadger-io/honeybadger-js/issues/1351,\n * caused by https://github.com/honeybadger-io/honeybadger-js/pull/1268.\n *\n * `serverExternalPackages` is unconditionally available from Next 15 onwards, which is\n * this package's minimum supported version, so the older\n * `experimental.serverComponentsExternalPackages` fallback is gone.\n */\nfunction withHoneybadgerExternalized(serverExternalPackages) {\n if (!Array.isArray(serverExternalPackages)) {\n log('debug', `adding serverExternalPackages option with value [\"${HONEYBADGER_JS_PACKAGE}\"]`);\n return [HONEYBADGER_JS_PACKAGE];\n }\n if (serverExternalPackages.includes(HONEYBADGER_JS_PACKAGE)) {\n return serverExternalPackages;\n }\n log('debug', `adding ${HONEYBADGER_JS_PACKAGE} to serverExternalPackages`);\n return [...serverExternalPackages, HONEYBADGER_JS_PACKAGE];\n}\n/**\n * Registers the source map upload on Next.js's post-compile hook, composing with any hook\n * the project already declares rather than replacing it.\n *\n * The hook is invoked from Next.js's generic build pipeline, so it runs for both Turbopack\n * and webpack builds. Next.js documents it as being \"useful for third-party tools to\n * collect build outputs like sourcemaps\".\n */\nfunction withSourceMapUpload(compiler, honeybadgerNextJsConfig, deleteBrowserSourcemaps) {\n const existingHook = compiler === null || compiler === void 0 ? void 0 : compiler.runAfterProductionCompile;\n return {\n ...compiler,\n runAfterProductionCompile: async (metadata) => {\n // The project's own hook runs first, and is not swallowed: if it throws, that is\n // its build failing, not ours.\n if (typeof existingHook === 'function') {\n await existingHook(metadata);\n }\n await uploadSourceMapsAfterBuild(honeybadgerNextJsConfig, metadata, { deleteBrowserSourcemaps });\n },\n };\n}\n/**\n * Opts into server source maps, so frames from `.next/server` can be symbolicated too.\n *\n * `productionBrowserSourceMaps` covers only the browser build, so without this option\n * there are no server maps to collect at all. Whether the uploaded server maps actually\n * match the frames reported at runtime is tracked in\n * https://github.com/honeybadger-io/honeybadger-js/issues/1602.\n *\n * Unlike the browser maps, these are never published: `.next/server` is not served, so\n * they are left in place after upload rather than deleted.\n */\nfunction withServerSourceMaps(experimental, enable) {\n // An explicit setting is the project's call, either way.\n if (!enable || (experimental === null || experimental === void 0 ? void 0 : experimental.serverSourceMaps) !== undefined) {\n return experimental;\n }\n log('debug', 'enabling experimental.serverSourceMaps so server frames can be symbolicated');\n return { ...experimental, serverSourceMaps: true };\n}\n/**\n * Wraps a Next.js config so Honeybadger's build-time requirements are applied: the\n * `@honeybadger-io/js` externalization, and source map upload after a production build.\n *\n * Instrumentation itself is not set up here — that moved to the bundler-agnostic\n * `instrumentation.ts` / `instrumentation-client.ts` conventions, so it works under both\n * Turbopack and webpack. See https://github.com/honeybadger-io/honeybadger-js/issues/1434.\n */\nexport function withHoneybadgerConfig(config = {}, honeybadgerNextJsConfig) {\n var _a;\n _silent = (_a = honeybadgerNextJsConfig === null || honeybadgerNextJsConfig === void 0 ? void 0 : honeybadgerNextJsConfig.silent) !== null && _a !== void 0 ? _a : true;\n const given = config;\n const uploadConfigured = isSourceMapUploadConfigured(honeybadgerNextJsConfig);\n // Next.js does not emit production browser source maps unless asked, so upload would\n // find nothing to send. `productionBrowserSourceMaps` is the only switch, and it also\n // serves the maps it generates.\n //\n // So turn it on when upload is configured, and have the post-build step delete the maps\n // once they are uploaded. An explicit setting is always respected: a project that asked\n // for served source maps keeps them, and keeps them served.\n const enableBrowserSourceMaps = given.productionBrowserSourceMaps === undefined && uploadConfigured;\n const experimental = withServerSourceMaps(given.experimental, uploadConfigured);\n return {\n ...config,\n serverExternalPackages: withHoneybadgerExternalized(given.serverExternalPackages),\n productionBrowserSourceMaps: enableBrowserSourceMaps ? true : given.productionBrowserSourceMaps,\n // Only introduce the key when there is something to put in it, so a config that never\n // mentioned `experimental` does not suddenly grow the field.\n ...(experimental ? { experimental } : {}),\n compiler: withSourceMapUpload(given.compiler, honeybadgerNextJsConfig, enableBrowserSourceMaps),\n };\n}\n//# sourceMappingURL=setup.js.map","import Honeybadger from '@honeybadger-io/js';\nimport * as nextServer from 'next/server';\n/**\n * The `waitUntil` primitive the hosting platform injects per request. Next.js\n * resolves `after()` through this same accessor, and it is the only channel\n * available in Pages Router API routes, which are invoked as `(req, res)` with\n * no context argument to read it from.\n */\nexport function requestContextWaitUntil() {\n var _a, _b;\n const context = globalThis[Symbol.for('@next/request-context')];\n const waitUntil = (_b = (_a = context === null || context === void 0 ? void 0 : context.get) === null || _a === void 0 ? void 0 : _a.call(context)) === null || _b === void 0 ? void 0 : _b.waitUntil;\n return typeof waitUntil === 'function' ? waitUntil : undefined;\n}\n/**\n * Ensure events are delivered before a serverless runtime freezes, without\n * delaying the response where the runtime lets us avoid it.\n *\n * In order of preference: Next.js `after()` (App Router only — it needs App Router\n * request context, so Pages Router must not call it), then a `waitUntil` from the\n * platform request context, then a blocking `flushAsync()` when the runtime offers\n * neither.\n *\n * Delivery failures are logged by the events worker and must not break the handler.\n */\nexport function scheduleFlush(options = {}) {\n var _a;\n const flush = () => Honeybadger.flushAsync().catch(() => { });\n if (options.useAfter) {\n const after = nextServer.after;\n if (typeof after === 'function') {\n // Exported but still refusable: `after()` throws outside a supported\n // context. Fall through to the remaining strategies rather than failing\n // the request.\n try {\n after(flush);\n return;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // try waitUntil / blocking flush below\n }\n }\n }\n const waitUntil = (_a = options.waitUntil) !== null && _a !== void 0 ? _a : requestContextWaitUntil();\n if (waitUntil) {\n waitUntil(flush());\n return;\n }\n return flush();\n}\n//# sourceMappingURL=flush.js.map","import Honeybadger from '@honeybadger-io/js';\n/**\n * Edge-safe equivalents of the inbound instrumentation helpers in\n * `@honeybadger-io/js` (src/server/instrumentation/http_event.ts). They are\n * duplicated here because this module must load in every runtime where\n * Node builtins (the `crypto` module, `process.hrtime`) are unavailable. Keep\n * the header names and the `request_id` / `correlation_id` contract in sync\n * with that file.\n *\n * Both request shapes Next.js uses are supported: the `*RequestEventContext` /\n * `*RequestEvent` pairs come in a web-`Headers`/`Request` variant (App Router\n * route handlers and middleware) and a Node-bag variant (Pages Router API\n * routes, which only ever run on the Node runtime).\n */\nfunction generateId() {\n const webCrypto = globalThis.crypto;\n if (webCrypto && typeof webCrypto.randomUUID === 'function') {\n try {\n return webCrypto.randomUUID();\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // fall through to manual generation\n }\n }\n // v4-shaped, not crypto-quality. Acceptable since this is a correlation id,\n // not a security token.\n return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (ch) => {\n const r = (Math.random() * 16) | 0;\n const v = ch === 'x' ? r : (r & 0x3) | 0x8;\n return v.toString(16);\n });\n}\nfunction readHeader(headers, name) {\n const value = headers.get(name);\n if (typeof value !== 'string') {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length ? trimmed : undefined;\n}\nfunction readNodeHeader(headers, name) {\n if (!headers) {\n return undefined;\n }\n const lower = name.toLowerCase();\n let value = headers[lower];\n if (value === undefined) {\n for (const key of Object.keys(headers)) {\n if (key.toLowerCase() === lower) {\n value = headers[key];\n break;\n }\n }\n }\n if (Array.isArray(value)) {\n value = value[0];\n }\n if (typeof value !== 'string') {\n return undefined;\n }\n const trimmed = value.trim();\n return trimmed.length ? trimmed : undefined;\n}\n/**\n * Shared id precedence. Kept in one place (rather than once per request shape)\n * so the header-name contract documented above is only spelled out once.\n *\n * The span ids do double duty. They are emitted as `trace_id` / `span_id`, and they also\n * back-fill `request_id` / `correlation_id` when no header supplied them — a trace id\n * already has exactly the semantics we want for a correlation id, since W3C trace context\n * reuses an inbound `traceparent` and mints a new one when there is none.\n *\n * That double duty is what makes a fault joinable to its request's events: both paths seed\n * from the same span, so with no id headers present a fault and its `request.handled` event\n * carry identical values for all four.\n */\nfunction seedIds(read, span = {}) {\n var _a, _b, _c, _d, _e, _f;\n const requestId = (_c = (_b = (_a = read('x-request-id')) !== null && _a !== void 0 ? _a : read('request-id')) !== null && _b !== void 0 ? _b : span.spanId) !== null && _c !== void 0 ? _c : generateId();\n const correlationId = (_f = (_e = (_d = read('x-correlation-id')) !== null && _d !== void 0 ? _d : read('x-amzn-trace-id')) !== null && _e !== void 0 ? _e : span.traceId) !== null && _f !== void 0 ? _f : requestId;\n const ids = { request_id: requestId, correlation_id: correlationId };\n if (span.traceId) {\n ids.trace_id = span.traceId;\n }\n if (span.spanId) {\n ids.span_id = span.spanId;\n }\n return ids;\n}\n/**\n * The active span's ids, or an empty object when OpenTelemetry is not in play.\n *\n * `@opentelemetry/api` is an optional peer dependency, and this module is reachable from\n * every runtime entry point, so it is loaded on demand and any failure to resolve it is\n * treated as \"no tracing configured\" rather than an error.\n */\nexport async function activeSpanIds() {\n var _a;\n try {\n const { trace } = await import('@opentelemetry/api');\n const spanContext = (_a = trace.getActiveSpan()) === null || _a === void 0 ? void 0 : _a.spanContext();\n if (!spanContext) {\n return {};\n }\n return { traceId: spanContext.traceId, spanId: spanContext.spanId };\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n return {};\n }\n}\n// App Router / middleware: headers are a web `Headers` instance.\nexport function seedRequestEventContext(headers, span = {}) {\n return seedIds((name) => readHeader(headers, name), span);\n}\n// Pages Router: headers are a Node bag (Pages routes are Node-only, never edge).\nexport function seedNodeRequestEventContext(headers, span = {}) {\n return seedIds((name) => readNodeHeader(headers, name), span);\n}\nexport function now() {\n return typeof performance !== 'undefined' ? performance.now() : Date.now();\n}\n// Mirrors Util.resolveInsights from @honeybadger-io/core: the master gate and\n// the per-source flag must both be on.\nexport function insightsHttpEnabled() {\n const insights = Honeybadger.config.insights;\n return (insights === null || insights === void 0 ? void 0 : insights.enabled) === true && (insights === null || insights === void 0 ? void 0 : insights.http) === true;\n}\n// The ids are embedded directly in the payload (instead of relying on the\n// store's eventContext merge) so the event carries them even where the\n// runtime, where there is no per-request store isolation. On the Node.js\n// runtime they match the seeded event context, so embedding is a no-op.\nfunction emitHandledEvent(method, path, status, start, ids) {\n const payload = {\n method,\n duration: Math.round(now() - start),\n ...ids,\n };\n if (typeof path === 'string') {\n payload.path = path;\n }\n if (typeof status === 'number') {\n payload.status = status;\n }\n Honeybadger.event('request.handled', payload);\n}\n// App Router / middleware: `req.url` is absolute, so parse out the pathname.\nexport function emitRequestEvent(req, status, start, ids) {\n let path;\n try {\n path = new URL(req.url).pathname;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n // relative or malformed URL — leave path unset\n }\n emitHandledEvent(req.method, path, status, start, ids);\n}\n// Pages Router: `req.url` is a relative path that may carry a query string.\nexport function emitNodeRequestEvent(req, status, start, ids) {\n const path = typeof req.url === 'string' ? req.url.split('?')[0] : undefined;\n emitHandledEvent(req.method, path, status, start, ids);\n}\n/**\n * OpenTelemetry path. Header values are not on the span by default; they arrive as\n * `http.request.header.*` attributes when the HTTP instrumentation is configured with\n * `headersToSpanAttributes`. Hyphens become underscores under the older semantic\n * conventions and are preserved under the stable ones, so both spellings are read.\n *\n * When no header is present the span and trace ids are used, so the ids stay\n * meaningful — and joinable to a trace — on platforms where the HTTP layer is not\n * visible, such as serverless platforms.\n */\nexport function seedSpanEventContext(attributes, spanContext) {\n const read = (name) => {\n const lower = name.toLowerCase();\n for (const key of [\n `http.request.header.${lower}`,\n `http.request.header.${lower.replace(/-/g, '_')}`,\n ]) {\n const value = attributes[key];\n const first = Array.isArray(value) ? value[0] : value;\n if (typeof first === 'string' && first.trim().length) {\n return first.trim();\n }\n }\n return undefined;\n };\n return seedIds(read, {\n traceId: spanContext.traceId || undefined,\n spanId: spanContext.spanId || undefined,\n });\n}\n//# sourceMappingURL=insights-instrumentation.js.map","import Honeybadger from '@honeybadger-io/js';\nimport { scheduleFlush } from './flush';\nimport { activeSpanIds, seedNodeRequestEventContext } from './insights-instrumentation';\n/**\n * Next.js uses thrown errors for control flow: `redirect()`, `notFound()`,\n * `forbidden()` and `unauthorized()` all throw an error carrying a `digest`\n * string (`NEXT_REDIRECT;...`, `NEXT_NOT_FOUND`, `NEXT_HTTP_ERROR_FALLBACK;...`).\n * These are not real failures — the framework catches them upstream to produce\n * the redirect/404/etc. — so we must let them pass without reporting, otherwise\n * every redirect shows up as an error in Honeybadger.\n *\n * We match on the `NEXT_` prefix rather than an exhaustive list so that any\n * present or future framework control-flow digest is covered. This is safe:\n * genuine errors that React tags with a `digest` use an opaque hash, and other\n * Next.js bailout signals (e.g. `BAILOUT_TO_CLIENT_SIDE_RENDERING`,\n * `DYNAMIC_SERVER_USAGE`) are not `NEXT_`-prefixed, so neither is skipped.\n */\nfunction isNextControlFlowError(error) {\n const digest = error === null || error === void 0 ? void 0 : error.digest;\n return typeof digest === 'string' && digest.startsWith('NEXT_');\n}\n/**\n * Reports errors passed to Next.js's `onRequestError` instrumentation hook.\n *\n * Wire it up in `instrumentation.ts`:\n *\n * ```ts\n * export const onRequestError = captureRequestError\n * ```\n *\n * Reaches Server Components, Route Handlers, Server Actions and middleware, and receives\n * the real error rather than the generic message Next.js hands to an error component.\n */\nexport async function captureRequestError(error, request, context) {\n if (isNextControlFlowError(error)) {\n return;\n }\n // Same header precedence *and* the same span as the Insights path, so a fault and the\n // events from the request it failed in carry matching ids. Next.js still has the request\n // span active when it calls this hook, and it is the very span the Insights processor\n // maps to `request.handled` — so with no id headers present all four ids are identical on\n // both, and the fault joins its request's events and trace.\n //\n // Deliberately not written to the event context: outside a `Honeybadger.run()` that\n // lands on a store shared by the whole process or isolate, so the ids would leak into\n // later requests' events. `onRequestError` also fires after the request has already\n // failed, so it is too late to decorate that request's own events anyway.\n const ids = seedNodeRequestEventContext(request.headers, await activeSpanIds());\n await Honeybadger.notifyAsync(error, {\n context: {\n ...ids,\n path: request.path,\n method: request.method,\n router_kind: context.routerKind,\n route_path: context.routePath,\n route_type: context.routeType,\n },\n });\n await scheduleFlush({ useAfter: true });\n}\n//# sourceMappingURL=capture-request-error.js.map","// Deliberately @honeybadger-io/js, not @honeybadger-io/react. The react package re-exports\n// this exact singleton, but reaching it through there also pulls in the error-boundary class\n// component — and this module sits in the main barrel that `instrumentation.ts` imports on\n// the server, where React Server Components reject a class component outright under\n// Turbopack.\nimport Honeybadger from '@honeybadger-io/js';\n/**\n * Records App Router navigations as breadcrumbs, so a fault carries the trail of routes\n * the user visited before it.\n *\n * Wire it up in `instrumentation-client.ts`:\n *\n * ```ts\n * export const onRouterTransitionStart = captureRouterTransitionStart\n * ```\n *\n * Exported as a ready-made handler rather than left as a function for the template to\n * declare, so the generated file works unchanged as both `.js` and `.ts` — an assignment\n * has no parameters to annotate, so there is no implicit `any` for `noImplicitAny` to\n * reject.\n */\nexport function captureRouterTransitionStart(url, navigationType) {\n Honeybadger.addBreadcrumb(`Navigated to ${url}`, {\n category: 'navigation',\n metadata: { url, navigationType },\n });\n}\n//# sourceMappingURL=capture-router-transition-start.js.map","import Honeybadger from '@honeybadger-io/js';\nimport { insightsHttpEnabled, seedSpanEventContext } from './insights-instrumentation';\nimport { scheduleFlush } from './flush';\n/**\n * Next.js instruments itself with OpenTelemetry and emits one root span per request,\n * `[http.method] [next.route]`, tagged `next.span_type: BaseServer.handleRequest`. Its\n * attributes carry the method, route, target and status, so mapping that span to a\n * `request.handled` event reports every request without wrapping any handler.\n *\n * Next instruments but does not export: spans only reach us once a tracer provider with\n * this processor is registered. See `registerHoneybadgerInsights`.\n */\nconst NEXT_REQUEST_SPAN_TYPE = 'BaseServer.handleRequest';\n/**\n * Request headers to copy onto the root span, so `request_id` and `correlation_id` can be\n * reused from an inbound request instead of falling back to the span and trace ids.\n *\n * Header values are not span attributes by default. `@vercel/otel` applies this map when\n * it creates the root span, which is the span this processor reads — and, unlike Node's\n * HTTP instrumentation, it works on serverless platforms too.\n *\n * Spread it into your own `registerOTel` call if you register OpenTelemetry yourself:\n *\n * ```ts\n * registerOTel({\n * attributesFromHeaders: { ...HONEYBADGER_HEADER_ATTRIBUTES },\n * spanProcessors: [honeybadgerSpanProcessor()],\n * })\n * ```\n *\n * Keep the header names in sync with `seedIds` in ./insights-instrumentation.\n */\nexport const HONEYBADGER_HEADER_ATTRIBUTES = {\n 'http.request.header.x-request-id': 'x-request-id',\n 'http.request.header.request-id': 'request-id',\n 'http.request.header.x-correlation-id': 'x-correlation-id',\n 'http.request.header.x-amzn-trace-id': 'x-amzn-trace-id',\n};\nfunction readString(attributes, ...names) {\n for (const name of names) {\n const value = attributes[name];\n if (typeof value === 'string' && value.length) {\n return value;\n }\n }\n return undefined;\n}\nfunction readNumber(attributes, ...names) {\n for (const name of names) {\n const value = attributes[name];\n if (typeof value === 'number') {\n return value;\n }\n if (typeof value === 'string' && value.trim().length && Number.isFinite(Number(value))) {\n return Number(value);\n }\n }\n return undefined;\n}\nfunction durationMs(duration) {\n if (!Array.isArray(duration) || duration.length !== 2) {\n return 0;\n }\n const [seconds, nanos] = duration;\n return Math.round(seconds * 1000 + nanos / 1e6);\n}\n/**\n * Path without the query string. `http.target` includes the query under the older\n * semantic conventions; `url.path` is already bare under the stable ones.\n */\nfunction readPath(attributes) {\n const target = readString(attributes, 'url.path', 'http.target');\n return typeof target === 'string' ? target.split('?')[0] : undefined;\n}\n/**\n * Maps Next.js's per-request span to a Honeybadger `request.handled` Insights event.\n *\n * Pass it to whatever registers OpenTelemetry in your `instrumentation.ts`:\n *\n * ```ts\n * import { registerOTel } from '@vercel/otel'\n * import { honeybadgerSpanProcessor } from '@honeybadger-io/nextjs'\n *\n * export function register() {\n * registerOTel({ serviceName: 'my-app', spanProcessors: [honeybadgerSpanProcessor()] })\n * }\n * ```\n *\n * `registerHoneybadgerInsights()` is the one-line equivalent when you have no other\n * OpenTelemetry setup of your own.\n */\nexport function honeybadgerSpanProcessor() {\n return {\n onStart() {\n // Nothing to do: the event is emitted once the request span is complete, which is\n // when the status and duration are known.\n },\n onEnd(span) {\n var _a;\n const attributes = (_a = span.attributes) !== null && _a !== void 0 ? _a : {};\n if (attributes['next.span_type'] !== NEXT_REQUEST_SPAN_TYPE) {\n return;\n }\n // Checked per event rather than at registration: configuration is loaded by\n // `register()` importing the honeybadger config files, which may happen after the\n // processor is constructed.\n if (!insightsHttpEnabled()) {\n return;\n }\n const spanContext = typeof span.spanContext === 'function' ? span.spanContext() : {};\n const ids = seedSpanEventContext(attributes, spanContext !== null && spanContext !== void 0 ? spanContext : {});\n const payload = {\n method: readString(attributes, 'http.request.method', 'http.method'),\n duration: durationMs(span.duration),\n ...ids,\n };\n const path = readPath(attributes);\n if (path) {\n payload.path = path;\n }\n const status = readNumber(attributes, 'http.response.status_code', 'http.status_code');\n if (typeof status === 'number') {\n payload.status = status;\n }\n // Emitted alongside the ids rather than replacing them, so an event can be joined\n // to a trace in another tool without changing what existing consumers read.\n if (spanContext === null || spanContext === void 0 ? void 0 : spanContext.traceId) {\n payload.trace_id = spanContext.traceId;\n }\n if (spanContext === null || spanContext === void 0 ? void 0 : spanContext.spanId) {\n payload.span_id = spanContext.spanId;\n }\n Honeybadger.event('request.handled', payload);\n // A span processor batches on its own lifecycle, which is not enough on a platform\n // that can freeze the invocation as soon as the response is sent.\n scheduleFlush({ useAfter: true });\n },\n async forceFlush() {\n await Honeybadger.flushAsync().catch(() => { });\n },\n async shutdown() {\n await Honeybadger.flushAsync().catch(() => { });\n },\n };\n}\n/**\n * Registers OpenTelemetry with only Honeybadger's span processor attached, for apps that\n * have no OpenTelemetry setup of their own. Call it from `register()` in\n * `instrumentation.ts`.\n *\n * `@vercel/otel` is an optional peer dependency: it is only needed for Insights, and it\n * loads where the full Node SDK cannot, such as serverless platforms. If you\n * already call `registerOTel` yourself, add `honeybadgerSpanProcessor()` to your\n * `spanProcessors` instead of calling this — registering twice would compete for the\n * global provider.\n */\nexport async function registerHoneybadgerInsights(options = {}) {\n var _a, _b;\n let registerOTel;\n try {\n ({ registerOTel } = await import('@vercel/otel'));\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n catch (error) {\n Honeybadger.logger.error('[Honeybadger] Insights request events need @vercel/otel. Install it, or drop the ' +\n 'registerHoneybadgerInsights() call — error reporting works without it.');\n return;\n }\n registerOTel({\n serviceName: (_b = (_a = options.serviceName) !== null && _a !== void 0 ? _a : process.env.NEXT_PUBLIC_HONEYBADGER_SERVICE_NAME) !== null && _b !== void 0 ? _b : 'nextjs-app',\n // Without this the id headers never reach the span, so request_id and\n // correlation_id would always fall back to the span and trace ids.\n attributesFromHeaders: {\n ...HONEYBADGER_HEADER_ATTRIBUTES,\n ...options.attributesFromHeaders,\n },\n spanProcessors: [honeybadgerSpanProcessor()],\n });\n}\n//# sourceMappingURL=insights.js.map"],"names":["log"],"mappings":";;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,cAAc,GAAG;AAC1B,IAAI,OAAO,OAAO,6BAA6B,CAAC,CAAC;AACjD,CAAC;AACD;AACA;AACA;AACA;AACA,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,WAAW,GAAG,CAAC,kBAAkB,EAAE,QAAQ,CAAC,CAAC;AACnD,SAASA,KAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;AAChC,IAAI,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;AACrD,QAAQ,OAAO,CAAC,IAAI,CAAC,CAAC,qBAAqB,EAAE,GAAG,CAAC,CAAC;AAClD,KAAK;AACL,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,2BAA2B,CAAC,uBAAuB,GAAG,EAAE,EAAE;AAC1E,IAAI,IAAI,uBAAuB,CAAC,sBAAsB,EAAE;AACxD,QAAQ,OAAO,KAAK,CAAC;AACrB,KAAK;AACL,IAAI,MAAM,MAAM,GAAG,uBAAuB,C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AAC,GAAG,CAAC,oCAAoC,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,EAAE,GAAG,YAAY;AACtL;AACA;AACA,QAAQ,qBAAqB,EAAE;AAC/B,YAAY,GAAG,6BAA6B;AAC5C,YAAY,GAAG,OAAO,CAAC,qBAAqB;AAC5C,SAAS;AACT,QAAQ,cAAc,EAAE,CAAC,wBAAwB,EAAE,CAAC;AACpD,KAAK,CAAC,CAAC;AACP;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './
|
|
1
|
+
export * from './setup';
|
|
2
|
+
export * from './capture-request-error';
|
|
3
|
+
export * from './capture-router-transition-start';
|
|
4
|
+
export * from './insights';
|
|
5
|
+
export type { HoneybadgerNextJsConfig } from './types';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -7,11 +7,39 @@ export type NodeRequestLike = {
|
|
|
7
7
|
export type RequestIds = {
|
|
8
8
|
request_id: string;
|
|
9
9
|
correlation_id: string;
|
|
10
|
+
trace_id?: string;
|
|
11
|
+
span_id?: string;
|
|
10
12
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Span and trace ids, when OpenTelemetry is in play.
|
|
15
|
+
*/
|
|
16
|
+
export type SpanIds = {
|
|
17
|
+
traceId?: string;
|
|
18
|
+
spanId?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* The active span's ids, or an empty object when OpenTelemetry is not in play.
|
|
22
|
+
*
|
|
23
|
+
* `@opentelemetry/api` is an optional peer dependency, and this module is reachable from
|
|
24
|
+
* every runtime entry point, so it is loaded on demand and any failure to resolve it is
|
|
25
|
+
* treated as "no tracing configured" rather than an error.
|
|
26
|
+
*/
|
|
27
|
+
export declare function activeSpanIds(): Promise<SpanIds>;
|
|
28
|
+
export declare function seedRequestEventContext(headers: Headers, span?: SpanIds): RequestIds;
|
|
29
|
+
export declare function seedNodeRequestEventContext(headers: NodeHeaders, span?: SpanIds): RequestIds;
|
|
13
30
|
export declare function now(): number;
|
|
14
31
|
export declare function insightsHttpEnabled(): boolean;
|
|
15
32
|
export declare function emitRequestEvent(req: Request, status: number | undefined, start: number, ids: RequestIds): void;
|
|
16
33
|
export declare function emitNodeRequestEvent(req: NodeRequestLike, status: number | undefined, start: number, ids: RequestIds): void;
|
|
34
|
+
/**
|
|
35
|
+
* OpenTelemetry path. Header values are not on the span by default; they arrive as
|
|
36
|
+
* `http.request.header.*` attributes when the HTTP instrumentation is configured with
|
|
37
|
+
* `headersToSpanAttributes`. Hyphens become underscores under the older semantic
|
|
38
|
+
* conventions and are preserved under the stable ones, so both spellings are read.
|
|
39
|
+
*
|
|
40
|
+
* When no header is present the span and trace ids are used, so the ids stay
|
|
41
|
+
* meaningful — and joinable to a trace — on platforms where the HTTP layer is not
|
|
42
|
+
* visible, such as serverless platforms.
|
|
43
|
+
*/
|
|
44
|
+
export declare function seedSpanEventContext(attributes: Record<string, unknown>, spanContext: SpanIds): RequestIds;
|
|
17
45
|
//# sourceMappingURL=insights-instrumentation.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Request headers to copy onto the root span, so `request_id` and `correlation_id` can be
|
|
3
|
+
* reused from an inbound request instead of falling back to the span and trace ids.
|
|
4
|
+
*
|
|
5
|
+
* Header values are not span attributes by default. `@vercel/otel` applies this map when
|
|
6
|
+
* it creates the root span, which is the span this processor reads — and, unlike Node's
|
|
7
|
+
* HTTP instrumentation, it works on serverless platforms too.
|
|
8
|
+
*
|
|
9
|
+
* Spread it into your own `registerOTel` call if you register OpenTelemetry yourself:
|
|
10
|
+
*
|
|
11
|
+
* ```ts
|
|
12
|
+
* registerOTel({
|
|
13
|
+
* attributesFromHeaders: { ...HONEYBADGER_HEADER_ATTRIBUTES },
|
|
14
|
+
* spanProcessors: [honeybadgerSpanProcessor()],
|
|
15
|
+
* })
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* Keep the header names in sync with `seedIds` in ./insights-instrumentation.
|
|
19
|
+
*/
|
|
20
|
+
export declare const HONEYBADGER_HEADER_ATTRIBUTES: Record<string, string>;
|
|
21
|
+
type HrTime = [number, number];
|
|
22
|
+
type ReadableSpanLike = {
|
|
23
|
+
attributes?: Record<string, unknown>;
|
|
24
|
+
duration?: HrTime;
|
|
25
|
+
spanContext?: () => {
|
|
26
|
+
traceId?: string;
|
|
27
|
+
spanId?: string;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export type SpanProcessorLike = {
|
|
31
|
+
onStart(): void;
|
|
32
|
+
onEnd(span: ReadableSpanLike): void;
|
|
33
|
+
forceFlush(): Promise<void>;
|
|
34
|
+
shutdown(): Promise<void>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Maps Next.js's per-request span to a Honeybadger `request.handled` Insights event.
|
|
38
|
+
*
|
|
39
|
+
* Pass it to whatever registers OpenTelemetry in your `instrumentation.ts`:
|
|
40
|
+
*
|
|
41
|
+
* ```ts
|
|
42
|
+
* import { registerOTel } from '@vercel/otel'
|
|
43
|
+
* import { honeybadgerSpanProcessor } from '@honeybadger-io/nextjs'
|
|
44
|
+
*
|
|
45
|
+
* export function register() {
|
|
46
|
+
* registerOTel({ serviceName: 'my-app', spanProcessors: [honeybadgerSpanProcessor()] })
|
|
47
|
+
* }
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* `registerHoneybadgerInsights()` is the one-line equivalent when you have no other
|
|
51
|
+
* OpenTelemetry setup of your own.
|
|
52
|
+
*/
|
|
53
|
+
export declare function honeybadgerSpanProcessor(): SpanProcessorLike;
|
|
54
|
+
export type RegisterHoneybadgerInsightsOptions = {
|
|
55
|
+
serviceName?: string;
|
|
56
|
+
/** Additional attribute-name -> header-name pairs, merged over the defaults. */
|
|
57
|
+
attributesFromHeaders?: Record<string, string>;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Registers OpenTelemetry with only Honeybadger's span processor attached, for apps that
|
|
61
|
+
* have no OpenTelemetry setup of their own. Call it from `register()` in
|
|
62
|
+
* `instrumentation.ts`.
|
|
63
|
+
*
|
|
64
|
+
* `@vercel/otel` is an optional peer dependency: it is only needed for Insights, and it
|
|
65
|
+
* loads where the full Node SDK cannot, such as serverless platforms. If you
|
|
66
|
+
* already call `registerOTel` yourself, add `honeybadgerSpanProcessor()` to your
|
|
67
|
+
* `spanProcessors` instead of calling this — registering twice would compete for the
|
|
68
|
+
* global provider.
|
|
69
|
+
*/
|
|
70
|
+
export declare function registerHoneybadgerInsights(options?: RegisterHoneybadgerInsightsOptions): Promise<void>;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=insights.d.ts.map
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HoneybadgerNextJsConfig } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Wraps a Next.js config so Honeybadger's build-time requirements are applied: the
|
|
4
|
+
* `@honeybadger-io/js` externalization, and source map upload after a production build.
|
|
5
|
+
*
|
|
6
|
+
* Instrumentation itself is not set up here — that moved to the bundler-agnostic
|
|
7
|
+
* `instrumentation.ts` / `instrumentation-client.ts` conventions, so it works under both
|
|
8
|
+
* Turbopack and webpack. See https://github.com/honeybadger-io/honeybadger-js/issues/1434.
|
|
9
|
+
*/
|
|
10
|
+
export declare function withHoneybadgerConfig<T extends object>(config?: T, honeybadgerNextJsConfig?: HoneybadgerNextJsConfig): T;
|
|
11
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Types } from '@honeybadger-io/plugin-core';
|
|
2
|
+
import { HoneybadgerNextJsConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Metadata Next.js passes to `compiler.runAfterProductionCompile`.
|
|
5
|
+
*/
|
|
6
|
+
export type AfterProductionCompileMetadata = {
|
|
7
|
+
distDir: string;
|
|
8
|
+
projectDir: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Whether the project has configured source map upload.
|
|
12
|
+
*
|
|
13
|
+
* Separate from `resolveUploadOptions` because `withHoneybadgerConfig` needs the answer
|
|
14
|
+
* while building the config, and must not emit the "not configured" warning there — the
|
|
15
|
+
* hook will do that once, at build time.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSourceMapUploadConfigured(honeybadgerNextJsConfig?: HoneybadgerNextJsConfig): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the upload options, falling back to the same environment variables the
|
|
20
|
+
* configuration templates use.
|
|
21
|
+
*
|
|
22
|
+
* Returns `null` rather than throwing when the project has not configured source map
|
|
23
|
+
* upload. `cleanOptions` throws on a missing `apiKey`/`assetsUrl`, and Next.js re-throws
|
|
24
|
+
* whatever this hook throws — so validating eagerly would fail the build of every app
|
|
25
|
+
* that simply does not use this feature.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveUploadOptions(honeybadgerNextJsConfig?: HoneybadgerNextJsConfig): Promise<Types.HbPluginOptions | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Pairs each built `.js` file with the source map it declares.
|
|
30
|
+
*
|
|
31
|
+
* `jsFilename` is the path relative to `distDir`, because that is what `assetsUrl`
|
|
32
|
+
* addresses: the configuration templates point it at `<origin>/_next`, and `.next/x`
|
|
33
|
+
* is served at `/_next/x`. `uploadSourcemap` builds `minified_url` by joining the two.
|
|
34
|
+
*
|
|
35
|
+
* Only `static/` and `server/` are walked — see `OUTPUT_DIRS`. Server maps exist only when
|
|
36
|
+
* `experimental.serverSourceMaps` is on, which `withHoneybadgerConfig` enables alongside
|
|
37
|
+
* upload. Server chunks are not served over HTTP, so whether their frames match the
|
|
38
|
+
* uploaded `minified_url` depends on the runtime path rewriting tracked in #1602 — but
|
|
39
|
+
* not uploading them at all guarantees server frames stay minified, which is the defect
|
|
40
|
+
* that issue reports.
|
|
41
|
+
*/
|
|
42
|
+
export declare function collectSourcemaps(distDir: string, ignorePaths?: string[]): Promise<Types.SourcemapInfo[]>;
|
|
43
|
+
/**
|
|
44
|
+
* Uploads the build's source maps to Honeybadger.
|
|
45
|
+
*
|
|
46
|
+
* Registered by `withHoneybadgerConfig` on Next.js's `compiler.runAfterProductionCompile`
|
|
47
|
+
* hook, which runs for both Turbopack and webpack builds.
|
|
48
|
+
*
|
|
49
|
+
* Next.js re-throws whatever this hook throws, which would fail the user's build, so a
|
|
50
|
+
* failed upload is only allowed to propagate when `ignoreErrors` is off.
|
|
51
|
+
*/
|
|
52
|
+
export declare function uploadSourceMapsAfterBuild(honeybadgerNextJsConfig: HoneybadgerNextJsConfig | undefined, metadata: AfterProductionCompileMetadata, options?: {
|
|
53
|
+
deleteBrowserSourcemaps?: boolean;
|
|
54
|
+
}): Promise<void>;
|
|
55
|
+
//# sourceMappingURL=source-maps.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,22 +1,34 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Options for `withHoneybadgerConfig`.
|
|
3
|
+
*
|
|
4
|
+
* `apiKey` and `assetsUrl` are what enable source map upload; both fall back to
|
|
5
|
+
* `NEXT_PUBLIC_HONEYBADGER_API_KEY` and `NEXT_PUBLIC_HONEYBADGER_ASSETS_URL`. Everything
|
|
6
|
+
* else is optional and defaulted by `@honeybadger-io/plugin-core`.
|
|
7
|
+
*/
|
|
2
8
|
export type HoneybadgerNextJsConfig = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
apiKey: string;
|
|
9
|
-
assetsUrl: string;
|
|
9
|
+
/** Honeybadger project API key. */
|
|
10
|
+
apiKey?: string;
|
|
11
|
+
/** Public URL of the build output, normally `https://your-site.com/_next`. */
|
|
12
|
+
assetsUrl?: string;
|
|
13
|
+
/** Ties uploaded maps to the errors that reference them; they must match to symbolicate. */
|
|
10
14
|
revision?: string;
|
|
11
15
|
endpoint?: string;
|
|
16
|
+
/** Suppresses this package's informational logging. Warnings and errors always print. */
|
|
12
17
|
silent?: boolean;
|
|
18
|
+
/** Log a failed upload instead of failing the build. */
|
|
13
19
|
ignoreErrors?: boolean;
|
|
20
|
+
ignorePaths?: Array<string>;
|
|
21
|
+
/** `NODE_ENV` values for which upload is skipped entirely. */
|
|
22
|
+
developmentEnvironments?: Array<string>;
|
|
14
23
|
retries?: number;
|
|
15
24
|
workerCount?: number;
|
|
25
|
+
/** Send a deploy notification once the maps are uploaded. */
|
|
16
26
|
deploy?: false | {
|
|
17
27
|
repository?: string;
|
|
18
28
|
environment?: string;
|
|
19
29
|
localUsername?: string;
|
|
20
30
|
};
|
|
31
|
+
/** Turn off source map upload without removing the rest of the configuration. */
|
|
32
|
+
disableSourceMapUpload?: boolean;
|
|
21
33
|
};
|
|
22
34
|
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@honeybadger-io/nextjs",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Next.js integration for Honeybadger",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nextjs",
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"import": "./dist/honeybadger-nextjs-edge.esm.js",
|
|
26
26
|
"require": "./dist/honeybadger-nextjs-edge.cjs.js"
|
|
27
27
|
},
|
|
28
|
+
"browser": {
|
|
29
|
+
"types": "./dist/client.d.ts",
|
|
30
|
+
"import": "./dist/honeybadger-nextjs-client.esm.js",
|
|
31
|
+
"require": "./dist/honeybadger-nextjs-client.cjs.js"
|
|
32
|
+
},
|
|
28
33
|
"types": "./dist/index.d.ts",
|
|
29
34
|
"import": "./dist/honeybadger-nextjs.esm.js",
|
|
30
35
|
"require": "./dist/honeybadger-nextjs.cjs.js"
|
|
@@ -62,33 +67,50 @@
|
|
|
62
67
|
"url": "https://github.com/honeybadger-io/honeybadger-js/issues"
|
|
63
68
|
},
|
|
64
69
|
"peerDependencies": {
|
|
65
|
-
"@
|
|
66
|
-
"
|
|
70
|
+
"@opentelemetry/api": ">= 1.9.0 < 2",
|
|
71
|
+
"@opentelemetry/sdk-trace-base": ">= 2.0.0 < 3",
|
|
72
|
+
"@vercel/otel": ">= 2.0.0 < 3",
|
|
73
|
+
"next": ">= 15.4.0"
|
|
67
74
|
},
|
|
68
75
|
"dependencies": {
|
|
69
|
-
"@honeybadger-io/js": "^6.16.
|
|
70
|
-
"@honeybadger-io/
|
|
76
|
+
"@honeybadger-io/js": "^6.16.5",
|
|
77
|
+
"@honeybadger-io/plugin-core": "^1.4.4",
|
|
78
|
+
"picomatch": "^2.3.2"
|
|
71
79
|
},
|
|
72
80
|
"devDependencies": {
|
|
73
|
-
"@
|
|
81
|
+
"@opentelemetry/api": "^1.9.1",
|
|
82
|
+
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
74
83
|
"@rollup/plugin-commonjs": "^22.0.0",
|
|
75
84
|
"@types/jest": "^29.5.3",
|
|
85
|
+
"@types/picomatch": "^2.3.4",
|
|
86
|
+
"@vercel/otel": "^2.1.3",
|
|
76
87
|
"jest": "^29.6.1",
|
|
77
88
|
"mock-fs": "^5.2.0",
|
|
78
|
-
"next": "^
|
|
79
|
-
"react": "^
|
|
80
|
-
"react-dom": "^
|
|
89
|
+
"next": "^15.4.0",
|
|
90
|
+
"react": "^19.1.0",
|
|
91
|
+
"react-dom": "^19.1.0",
|
|
81
92
|
"rollup": "^2.70.2",
|
|
82
93
|
"rollup-plugin-copy": "^3.4.0",
|
|
83
94
|
"ts-jest": "^29.1.1",
|
|
84
|
-
"typescript": "^
|
|
95
|
+
"typescript": "^5.9.3",
|
|
85
96
|
"undici": "^6.27.0"
|
|
86
97
|
},
|
|
87
98
|
"engines": {
|
|
88
|
-
"node": ">=
|
|
99
|
+
"node": ">=20.9.0"
|
|
89
100
|
},
|
|
90
101
|
"publishConfig": {
|
|
91
102
|
"access": "public"
|
|
92
103
|
},
|
|
93
|
-
"
|
|
104
|
+
"peerDependenciesMeta": {
|
|
105
|
+
"@opentelemetry/api": {
|
|
106
|
+
"optional": true
|
|
107
|
+
},
|
|
108
|
+
"@opentelemetry/sdk-trace-base": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"@vercel/otel": {
|
|
112
|
+
"optional": true
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
"gitHead": "03f1158e4d2e020f290cb1630a4e3e1d5ff4934b"
|
|
94
116
|
}
|