Skip to content

Commit

Permalink
fix(remix): Skip capturing aborted requests. (#9659)
Browse files Browse the repository at this point in the history
Remix documentation suggests users avoid capturing aborted requests.
  • Loading branch information
onurtemizkan committed Nov 27, 2023
1 parent 61bcf73 commit 4c75f85
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/remix/src/utils/instrumentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,13 @@ export async function captureRemixServerException(err: unknown, name: string, re
return;
}

// Skip capturing if the request is aborted as Remix docs suggest
// Ref: https://remix.run/docs/en/main/file-conventions/entry.server#handleerror
if (request.signal.aborted) {
__DEBUG_BUILD__ && logger.warn('Skipping capture of aborted request');
return;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
let normalizedRequest: Record<string, unknown> = request as unknown as any;

Expand Down

0 comments on commit 4c75f85

Please sign in to comment.