feat: add reportMisconfiguration flag to detect 403/404 on site config#280
Open
MO-Thibault wants to merge 3 commits intoOptable:masterfrom
Open
feat: add reportMisconfiguration flag to detect 403/404 on site config#280MO-Thibault wants to merge 3 commits intoOptable:masterfrom
MO-Thibault wants to merge 3 commits intoOptable:masterfrom
Conversation
When enabled, catches 403/404 errors from the Site() call during SDK
initialization and fires a best-effort profile() to the default-sdk
catch-all source with { error_403: hostname } or { error_404: hostname }.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
…rror Network/CORS errors throw TypeError, not FetchError, so the instanceof check was silently swallowing misconfiguration signals. Now fires on any Site() failure: named keys for 403/404, error_config for network errors.
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
reportMisconfiguration?: booleantoInitConfig/ResolvedConfigSite()call during SDK initializationprofile()to thedefault-sdkcatch-all source with{ error_403: hostname }or{ error_404: hostname }How it works
FetchError(new) exposes the HTTP status on thrown errors, allowinginitialize()to distinguish 403/404 from generic network failures. The profile call uses{ ...this.dcn, site: 'default-sdk' }— same host and node, but the guaranteed catch-all slug present in every DCN — so delivery is reliable even when the original slug is the source of the problem.Usage
Test plan
reportMisconfiguration: true+ 403 → profile fired with{ error_403: "localhost" }too=default-sdkreportMisconfiguration: true+ 404 → profile fired with{ error_404: "localhost" }too=default-sdkreportMisconfiguration: false+ 403 → no profile callreportMisconfiguration: true+ 500 → no profile call🤖 Generated with Claude Code