Repository navigation
fix: improve OAuth refresh token rejection error message - #1130
Patrick Nilan (pnilan) merged 2 commits into
Conversation
Co-Authored-By: bot_apk <apk@cognition.ai>
🤖 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 TricksTesting This CDK VersionYou can test this version of the CDK using the following: # Run the CLI from this branch:
uvx 'git+https://github.com/airbytehq/airbyte-python-cdk.git@devin/1787614944-oauth-refresh-token-error-message#egg=airbyte-python-cdk[dev]' --help
# Update a connector to use the CDK from this branch ref:
cd airbyte-integrations/connectors/source-example
poe use-cdk-branch devin/1787614944-oauth-refresh-token-error-messagePR Slash CommandsAirbyte Maintainers can execute the following slash commands on your PR:
|
There was a problem hiding this comment.
Pull request overview
Improves the error reporting when an OAuth refresh token is rejected during AbstractOauth2Authenticator._make_handled_request, replacing a UI-specific/templated user message and enriching the internal diagnostics with provider response details.
Changes:
- Updates the user-facing
AirbyteTracedException.messagefor refresh-token rejection to be UI-agnostic and clearer. - Updates
AirbyteTracedException.internal_messageto include OAuth provider HTTP status/body details and chains the original exception (from e). - Adjusts unit tests to assert the new user message and that provider response information is present in
internal_message.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| airbyte_cdk/sources/streams/http/requests_native_auth/abstract_oauth.py | Updates refresh-token rejection exception messaging and adds provider-response details to internal diagnostics. |
| unit_tests/sources/streams/http/requests_native_auth/test_requests_native_auth.py | Updates assertions to match the new user message and verify internal diagnostic content. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-Authored-By: bot_apk <apk@cognition.ai>
Summary
Resolves https://github.com/airbytehq/airbyte-internal-issues/issues/17024
Related to https://github.com/airbytehq/airbyte-internal-issues/issues/17023
The refresh-token-rejection branch of
AbstractOauth2Authenticator._make_handled_requestraised anAirbyteTracedExceptionwhose user-facing message contained a literal, never-substituted template placeholder and a Cloud-UI-specific path:Changes in
abstract_oauth.py:message(no placeholder, UI-agnostic remediation, stillconfig_error):Refresh token was rejected by the OAuth provider (invalid, expired, or already used). Re-authenticate this source's credentials in its connection settings.internal_messagenow carries the provider's actual response instead of duplicating the user message:Refresh token rejected by the OAuth token endpoint. HTTP {status}: {body}(e.g. Linear's400 {"error":"invalid_request","error_description":"Invalid refresh token"}), and the exception is chained withfrom e.Unit test assertions in
test_requests_native_auth.py::test_refresh_access_token_wrappedupdated to match the new message and to verify the provider response is included ininternal_message.No behavior change:
FailureType.config_erroris unchanged, so retry semantics are unaffected.Test plan
poetry run pytest unit_tests/sources/streams/http/requests_native_auth/test_requests_native_auth.py— 40 passedpoetry run ruff check,poetry run ruff format --check, andpoetry run mypy --config-file mypy.inion the touched module — cleanLink to Devin session: https://app.devin.ai/sessions/ce403907eba74f2c84f3374b1a1f5292