Skip to content

Commit

Permalink
Wrap all API endpoint with Sentry.withSentry
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadorequest committed Jun 25, 2021
1 parent f9571d8 commit d285b72
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/pages/api/autoRedirectToLocalisedPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
AMPLITUDE_EVENTS,
} from '@/modules/core/amplitude/events';
import localeMiddleware from '@/modules/core/i18n/middlewares/localeMiddleware';
import { withSentry } from '@sentry/nextjs';
import * as Sentry from '@sentry/nextjs';
import {
NextApiRequest,
NextApiResponse,
Expand All @@ -28,5 +28,5 @@ const autoRedirectToLocalisedPage = async (req: NextApiRequest, res: NextApiResp
return await localeMiddleware(req, res);
};

export default withSentry(autoRedirectToLocalisedPage);
export default Sentry.withSentry(autoRedirectToLocalisedPage);

2 changes: 1 addition & 1 deletion src/pages/api/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ export const error = async (req: NextApiRequest, res: NextApiResponse): Promise<
}
};

export default error;
export default Sentry.withSentry(error);
2 changes: 1 addition & 1 deletion src/pages/api/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,4 @@ export const preview = async (req: EndpointRequest, res: NextApiResponse): Promi
}
};

export default preview;
export default Sentry.withSentry(preview);
1 change: 1 addition & 0 deletions src/pages/api/startVercelDeployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import dispatchWorkflowByPath from '@/modules/core/githubActions/dispatchWorkflo
import { createLogger } from '@/modules/core/logging/logger';
import { ALERT_TYPES } from '@/modules/core/sentry/config';
import { configureReq } from '@/modules/core/sentry/server';
import { flushSafe } from '@/modules/core/sentry/universal';
import * as Sentry from '@sentry/nextjs';
import size from 'lodash.size';
import {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ export const status = async (req: NextApiRequest, res: NextApiResponse): Promise
}
};

export default status;
export default Sentry.withSentry(status);
2 changes: 1 addition & 1 deletion src/pages/api/webhooks/deploymentCompleted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,4 @@ export const deploymentCompleted = async (req: EndpointRequest, res: NextApiResp
}
};

export default deploymentCompleted;
export default Sentry.withSentry(deploymentCompleted);

1 comment on commit d285b72

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.