OUT-4026: suppress AssemblyMissingHeadersError bot noise - #236
Merged
Conversation
Match the Sentry filter by error name instead of instanceof, which never matched across the separate instrumentation bundle. Add robots.ts and sitemap.ts so bot hits to those paths skip the authed root layout. Fixes CLIENT-HOME-V3-1P Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe PR prevents crawler requests from generating expected missing-auth-header events in Sentry.
Confidence Score: 5/5The PR appears safe to merge, with no concrete blocking or non-blocking defects identified. The metadata routes align with the configured Next.js routing behavior, and the shared name-based filter matches the error factory’s assigned name while continuing to forward other errors. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Bot requests robots.txt or sitemap.xml] --> B[Next.js metadata route]
B --> C[Static 200 response]
D[Other request without injected auth headers] --> E[AssemblyMissingHeadersError]
E --> F{Error name matches shared constant?}
F -->|Yes| G[Skip Sentry capture]
F -->|No| H[Capture request error in Sentry]
Reviews (1): Last reviewed commit: "fix(OUT-4026): suppress AssemblyMissingH..." | Re-trigger Greptile |
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.
Changes
onRequestErrorsuppression insrc/instrumentation.tsto match by error name instead ofinstanceof. The original guard never fired —instrumentation.tsis a separate bundle, so its copy ofAssemblyMissingHeadersErrorhas a different class identity than the one thrown in app code, makinginstanceofalwaysfalse. Every occurrence of this error has been reaching Sentry since the guard was introduced.ASSEMBLY_MISSING_HEADERS_ERROR_NAMEconstant insrc/lib/assembly/errors.tsso the filter and the error definition can't drift apart.src/app/robots.ts(disallow all crawling) andsrc/app/sitemap.ts(empty) so bot hits to/robots.txtand/sitemap.xmlresolve to static 200s instead of falling through to the authenticated root layout, which throwsAssemblyMissingHeadersError.Root cause
/robots.txtand/sitemap.xmlare excluded from the proxy matcher (src/proxy.ts), so no auth headers are injected. With no route defined, Next.js rendered the not-found page, which still runs the rootlayout.tsx→authenticateHeaders()→ throws. Bots/crawlers probing those paths generated the noise (75 occurrences / 30 "users", escalating).Testing Criteria
pnpm typecheckandpnpm lintpass clean.curl /robots.txt500s through the root layout withAssemblyMissingHeadersError; post-change, both/robots.txtand/sitemap.xmlreturn static-prerendered 200s and bypass the layout.Notes
robots.ts/sitemap.tseliminate the error for the two well-known probed paths; theinstrumentation.tsfix is the safety net that correctly suppresses the same error for any other unrouted path a bot might guess.Fixes CLIENT-HOME-V3-1P— auto-closes the Sentry issue on merge.Impact & Surface Area of Change
onRequestErrornow suppresses any error namedAssemblyMissingHeadersError. String is highly specific, so collision risk is negligible, but note the check is broader thaninstanceofby design./robots.txtand/sitemap.xml; no existing route behavior changes. Disallowing all crawling is intended for this token-authenticated, per-tenant app.🤖 Generated with Claude Code