fix(source-twilio): treat HTTP 401 as transient error for sporadic CloudFront auth failures#75214
fix(source-twilio): treat HTTP 401 as transient error for sporadic CloudFront auth failures#75214devin-ai-integration[bot] wants to merge 2 commits intomasterfrom
Conversation
…oudFront auth failures Co-Authored-By: gl_anatolii.yatsuk <gl_anatolii.yatsuk@airbyte.io>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
👋 Greetings, Airbyte Team Member!Here are some helpful tips and reminders for your convenience. 💡 Show Tips and TricksPR Slash CommandsAirbyte Maintainers (that's you!) can execute the following slash commands on your PR:
📚 Show Repo GuidanceHelpful Resources
|
|
Deploy preview for airbyte-docs ready! ✅ Preview Built with commit 5458d82. |
Co-Authored-By: gl_anatolii.yatsuk <gl_anatolii.yatsuk@airbyte.io>
|
/publish-connectors-prerelease
|
|
What
Sporadic HTTP 401 errors from Twilio's API have been observed in production, caused by transient CloudFront CDN edge failures (
X-Cache: Error from cloudfront) rather than actual credential issues. These currently cause partition-level failures because the CDK's default error mapping treats 401 as a non-retryableconfig_error.How
Added an
HttpResponseFilterwithaction: RETRYand a predicate to thebase_requester'serror_handlerin the declarative manifest. The predicate matches only when both conditions are true:status: 401(Twilio's error format)X-Cacheheader equalsError from cloudfront(CloudFront CDN failure signature)This ensures only transient CloudFront-originated 401s are retried. Genuine Twilio authentication failures (invalid credentials, revoked tokens) are not matched and continue to fail immediately via the CDK's default error mapping.
Review guide
manifest.yaml— the only functional change. New response filter at lines 30–34, placed between the 429 (rate limit) and 404 (ignore) filters.Checklist for reviewer
_matches_filterevaluateshttp_codes OR predicate OR error_message_contains— since nohttp_codesare set here, only the predicate is evaluated, and both conditions within it must be true.response.get('status', 0)returns 0 (body is record data, not an error object), so the predicate evaluates toFalse. Safe.X-Cacheheader value (Error from cloudfront) matches production logs — the original incident had this exact string.User Impact
Syncs that previously failed on a partition due to transient Twilio/CloudFront 401 errors will now retry and succeed. Genuine authentication failures remain unaffected and still fail immediately.
Can this PR be safely reverted and rolled back?
Link to Devin session: https://app.devin.ai/sessions/d2bdc8f33f1740f0a55d6ba23f7340d3