fix(chat): fail-safe to noindex if the deployment lookup errors#5396
Merged
Conversation
generateMetadata queried the DB with no error handling, unlike the identical query in api/chat/[identifier]/route.ts (which already wraps it in try/catch). There's no error.tsx under app/(interfaces)/chat/ — metadata resolution errors aren't caught by route-segment error boundaries at all, only the root global-error.tsx — so a DB hiccup during this lookup would take the whole page down to a generic error page instead of just failing to determine indexability. Catches the error, logs it, and defaults to noindex: if we can't confirm the deployment is safely public, that's the correct SEO default anyway, not a reason to crash the request. Flagged by Cursor Bugbot on #5388 (already merged); this ships the fix as a standalone follow-up since the underlying code is already live.
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview Comments document that this route has no segment Reviewed by Cursor Bugbot for commit 18fa798. Configure here. |
Contributor
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.
Summary
generateMetadataDB lookup had no error handling, unlike the identical query inapi/chat/[identifier]/route.tswhich already wraps it in try/catcherror.tsxunderapp/(interfaces)/chat/, and Next.js docs confirmgenerateMetadataresolves outside the rendered tree that route-segment error boundaries wrap — only the rootglobal-error.tsxwould catch a throw here, meaning a DB hiccup during this lookup would crash the whole page to a generic error page instead of degrading like the old static-metadata version didisIndexable = false. This is also just the correct default independent of the bug — if we can't confirm a deployment is safely public, noindex is the right call, not a 500Type of Change
Testing
Tested manually — live dev server, confirmed the success path (
noindex, nofollowfor a nonexistent identifier) is unchanged. Typecheck and Biome lint pass.Checklist