Skip to content

Commit 87efd29

Browse files
committed
fix wrapped handler type
1 parent ec6822d commit 87efd29

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/nextjs/src/utils/withSentry.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ import { extractTraceparentData, hasTracingEnabled } from '@sentry/tracing';
33
import { Transaction } from '@sentry/types';
44
import { addExceptionMechanism, isString, logger, objectify, stripUrlQueryAndFragment } from '@sentry/utils';
55
import * as domain from 'domain';
6-
import { NextApiHandler, NextApiResponse } from 'next';
6+
import { NextApiHandler, NextApiRequest, NextApiResponse } from 'next';
77

88
const { parseRequest } = Handlers;
99

10-
// purely for clarity
11-
type WrappedNextApiHandler = NextApiHandler;
10+
// This is the same as the `NextApiHandler` type, except instead of having a return type of `void | Promise<void>`, it's
11+
// only `Promise<void>`, because wrapped handlers are always async
12+
export type WrappedNextApiHandler = (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
1213

1314
export type AugmentedNextApiResponse = NextApiResponse & {
1415
__sentryTransaction?: Transaction;

0 commit comments

Comments
 (0)