fix: silence NoFallbackError in router-server outer catch#90554
Open
sleitor wants to merge 1 commit intovercel:canaryfrom
Open
fix: silence NoFallbackError in router-server outer catch#90554sleitor wants to merge 1 commit intovercel:canaryfrom
sleitor wants to merge 1 commit intovercel:canaryfrom
Conversation
NoFallbackError is internal control-flow used by dynamicParams=false routes to signal that an unknown param has no static rendering. It is caught and handled inside handleRequest (producing the correct 404 response), but in some edge cases (e.g. when the not-found page itself triggers the error) it can propagate to the outer catch block where it was previously logged via console.error and served as a 500. This produces false-positive error alerts in APM tools (Datadog dd-trace, Sentry, New Relic) that intercept console.error, flooding dashboards with noise on every bot crawl of a dynamicParams=false route. Fix: treat NoFallbackError in the outer catch as a 404 (not 500) and skip the console.error call, since it is not a real application error. Fixes vercel#90537
Collaborator
|
Allow CI Workflow Run
Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What?
Prevent
NoFallbackErrorfrom being logged viaconsole.errorin the outer catch block ofrouter-server.ts, and treat it as a 404 (not a 500).Why?
NoFallbackErroris internal control-flow — thrown bydynamicParams = falseroutes when an unknown param is requested. It is caught and handled insidehandleRequest(correctly producing a 404 response), but in edge cases (e.g. when the not-found page itself triggers the error) it can propagate to the outer catch block.Previously, the outer catch logged it via
console.errorand attempted to serve a 500 response. This causes:console.errorand report every bot crawl of adynamicParams = falseroute as an application error.NoFallbackErroris semantically a 404, not a 500.How?
Added an
else if (err instanceof NoFallbackError)branch before theconsole.errorcall. When matched, it setsinvokePath = '/404'andinvokeStatus = '404'without logging.Fixes #90537