@sentry/nextjs
Version:
Official Sentry SDK for Next.js
16 lines (15 loc) • 962 B
TypeScript
import { EdgeRouteHandler } from '../edge/types';
/**
* Wraps Next.js middleware with Sentry error and performance instrumentation.
*
* From Next.js 14 onwards the middleware transaction is created by Next.js' native OpenTelemetry
* instrumentation (the `Middleware.execute` span, normalized by `enhanceMiddlewareRootSpan`). In that case this
* wrapper does not start a span of its own, as that would emit a second, redundant middleware span nested inside
* the root span. It only forks an isolation scope, captures errors, and flushes. Next.js 13 does not emit
* `Middleware.execute`, so there the wrapper still starts the transaction itself.
*
* @param middleware The middleware handler.
* @returns a wrapped middleware handler.
*/
export declare function wrapMiddlewareWithSentry<H extends EdgeRouteHandler>(middleware: H): (...params: Parameters<H>) => Promise<ReturnType<H>>;
//# sourceMappingURL=wrapMiddlewareWithSentry.d.ts.map