Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
38 lines
1.0 KiB
Plaintext
38 lines
1.0 KiB
Plaintext
import { withScope, headersToDict, captureException } from '@sentry/core';
|
|
import { waitUntil, flushSafelyWithTimeout } from './utils/responseEnd.js';
|
|
|
|
/**
|
|
* Reports errors passed to the the Next.js `onRequestError` instrumentation hook.
|
|
*/
|
|
function captureRequestError(error, request, errorContext) {
|
|
withScope(scope => {
|
|
scope.setSDKProcessingMetadata({
|
|
normalizedRequest: {
|
|
headers: headersToDict(request.headers),
|
|
method: request.method,
|
|
} ,
|
|
});
|
|
|
|
scope.setContext('nextjs', {
|
|
request_path: request.path,
|
|
router_kind: errorContext.routerKind,
|
|
router_path: errorContext.routePath,
|
|
route_type: errorContext.routeType,
|
|
});
|
|
|
|
scope.setTransactionName(errorContext.routePath);
|
|
|
|
captureException(error, {
|
|
mechanism: {
|
|
handled: false,
|
|
type: 'auto.function.nextjs.on_request_error',
|
|
},
|
|
});
|
|
|
|
waitUntil(flushSafelyWithTimeout());
|
|
});
|
|
}
|
|
|
|
export { captureRequestError };
|
|
//# sourceMappingURL=captureRequestError.js.map
|