Skip to content

Commit

Permalink
Source Airtable: config errors (airbytehq#31360)
Browse files Browse the repository at this point in the history
  • Loading branch information
artem1205 authored and ariesgun committed Oct 20, 2023
1 parent e88c076 commit af1e590
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion airbyte-integrations/connectors/source-airtable/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ COPY source_airtable ./source_airtable
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=4.1.2
LABEL io.airbyte.version=4.1.3
LABEL io.airbyte.name=airbyte/source-airtable
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data:
connectorSubtype: api
connectorType: source
definitionId: 14c6e7ea-97ed-4f5e-a7b5-25e9a80b8212
dockerImageTag: 4.1.2
dockerImageTag: 4.1.3
dockerRepository: airbyte/source-airtable
githubIssueLabel: source-airtable
icon: airtable.svg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from airbyte_cdk.sources.streams.http import HttpStream
from airbyte_cdk.sources.streams.http.requests_native_auth import TokenAuthenticator
from airbyte_cdk.sources.utils.transform import TransformConfig, TypeTransformer
from airbyte_cdk.utils import AirbyteTracedException
from airbyte_protocol.models import FailureType
from source_airtable.schema_helpers import SchemaHelpers

URL_BASE: str = "https://api.airtable.com/v0/"
Expand All @@ -31,6 +33,15 @@ def path(self, **kwargs) -> str:
return "meta/bases"

def should_retry(self, response: requests.Response) -> bool:
if (
response.status_code == requests.codes.FORBIDDEN
and response.json().get("error", {}).get("type") == "INVALID_PERMISSIONS_OR_MODEL_NOT_FOUND"
):
if isinstance(self._session.auth, TokenAuthenticator):
error_message = "Personal Access Token has not enough permissions, please add all required permissions to existed one or create new PAT, see docs for more info: https://docs.airbyte.com/integrations/sources/airtable#step-1-set-up-airtable"
else:
error_message = "Access Token has not enough permissions, please reauthenticate"
raise AirbyteTracedException(message=error_message, failure_type=FailureType.config_error)
if response.status_code == 403 or response.status_code == 422:
self.logger.error(f"Stream {self.name}: permission denied or entity is unprocessable. Skipping.")
setattr(self, "raise_on_http_errors", False)
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/airtable.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ See information about rate limits [here](https://airtable.com/developers/web/api

| Version | Date | Pull Request | Subject |
|:--------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------|
| 4.1.3 | 2023-10-13 | [31360](https://github.com/airbytehq/airbyte/pull/31360) | Update error message for invalid permissions |
| 4.1.2 | 2023-10-10 | [31215](https://github.com/airbytehq/airbyte/pull/31215) | Exclude bases without permission |
| 4.1.1 | 2023-10-10 | [31119](https://github.com/airbytehq/airbyte/pull/31119) | Add user-friendly error message when refresh token has expired |
| 4.1.0 | 2023-10-10 | [31044](https://github.com/airbytehq/airbyte/pull/31044) | Add source table name to output records |
Expand Down

0 comments on commit af1e590

Please sign in to comment.