Skip to content

Commit

Permalink
Flush Sentry events manually server-side (#2698)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregberge authored Jan 8, 2025
1 parent 1138d59 commit 88397bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/gitbook/src/instrumentation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import * as Sentry from '@sentry/nextjs';
import { Instrumentation } from 'next';

export async function register() {
await import('../sentry.edge.config');
}

export const onRequestError = Sentry.captureRequestError;
export const onRequestError: Instrumentation.onRequestError = async (...args) => {
Sentry.captureRequestError(...args);
// There is an issue on Cloudflare that requires us to flush the events manually.
// https://github.com/getsentry/sentry-javascript/issues/14931#issuecomment-2577640023
await Sentry.flush();
};

0 comments on commit 88397bf

Please sign in to comment.