Skip to content

Commit

Permalink
fix(nextjs): Update check for not found navigation error (#14378)
Browse files Browse the repository at this point in the history
  • Loading branch information
chargome authored Nov 21, 2024
1 parent 415068a commit 3fe2eae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"extends": "../../package.json"
},
"sentryTest": {
"optional": true,
"optionalVariants": [
{
"build-command": "test:build-canary",
Expand Down
7 changes: 6 additions & 1 deletion packages/nextjs/src/common/nextNavigationErrorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ import { isError } from '@sentry/core';
* https://beta.nextjs.org/docs/api-reference/notfound#notfound
*/
export function isNotFoundNavigationError(subject: unknown): boolean {
return isError(subject) && (subject as Error & { digest?: unknown }).digest === 'NEXT_NOT_FOUND';
return (
isError(subject) &&
['NEXT_NOT_FOUND', 'NEXT_HTTP_ERROR_FALLBACK;404'].includes(
(subject as Error & { digest?: unknown }).digest as string,
)
);
}

/**
Expand Down

0 comments on commit 3fe2eae

Please sign in to comment.