diff --git a/airbyte-integrations/connectors/source-amazon-ads/Dockerfile b/airbyte-integrations/connectors/source-amazon-ads/Dockerfile index 3ffd3401acb82..230c491297a52 100644 --- a/airbyte-integrations/connectors/source-amazon-ads/Dockerfile +++ b/airbyte-integrations/connectors/source-amazon-ads/Dockerfile @@ -13,5 +13,5 @@ ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py" ENTRYPOINT ["python", "/airbyte/integration_code/main.py"] -LABEL io.airbyte.version=3.1.0 +LABEL io.airbyte.version=3.1.1 LABEL io.airbyte.name=airbyte/source-amazon-ads diff --git a/airbyte-integrations/connectors/source-amazon-ads/metadata.yaml b/airbyte-integrations/connectors/source-amazon-ads/metadata.yaml index 9881c233f8fc9..0433fe6c50c52 100644 --- a/airbyte-integrations/connectors/source-amazon-ads/metadata.yaml +++ b/airbyte-integrations/connectors/source-amazon-ads/metadata.yaml @@ -8,7 +8,7 @@ data: connectorSubtype: api connectorType: source definitionId: c6b0a29e-1da9-4512-9002-7bfd0cba2246 - dockerImageTag: 3.1.0 + dockerImageTag: 3.1.1 dockerRepository: airbyte/source-amazon-ads githubIssueLabel: source-amazon-ads icon: amazonads.svg diff --git a/airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/sponsored_products.py b/airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/sponsored_products.py index 14b86f888737a..c3b596ae0490c 100644 --- a/airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/sponsored_products.py +++ b/airbyte-integrations/connectors/source-amazon-ads/source_amazon_ads/streams/sponsored_products.py @@ -104,6 +104,13 @@ def parse_response(self, response: requests.Response, **kwargs) -> Iterable[Mapp f"Skip current AdGroup because it does not support request {response.request.url} for " f"{response.request.headers['Amazon-Advertising-API-Scope']} profile: {response.text}" ) + elif response.status_code == HTTPStatus.NOT_FOUND: + # 404 Either the specified ad group identifier was not found, + # or the specified ad group was found but no associated bid was found. + self.logger.warning( + f"Skip current AdGroup because the specified ad group has no associated bid {response.request.url} for " + f"{response.request.headers['Amazon-Advertising-API-Scope']} profile: {response.text}" + ) else: response.raise_for_status() diff --git a/airbyte-integrations/connectors/source-amazon-ads/unit_tests/test_streams.py b/airbyte-integrations/connectors/source-amazon-ads/unit_tests/test_streams.py index 2a9abb1e4d16e..405d3a5a05ca0 100644 --- a/airbyte-integrations/connectors/source-amazon-ads/unit_tests/test_streams.py +++ b/airbyte-integrations/connectors/source-amazon-ads/unit_tests/test_streams.py @@ -72,8 +72,8 @@ def setup_responses( ) -def get_all_stream_records(stream): - records = stream.read_records(SyncMode.full_refresh) +def get_all_stream_records(stream, stream_slice=None): + records = stream.read_records(SyncMode.full_refresh, stream_slice=stream_slice) return [r for r in records] @@ -273,3 +273,20 @@ def test_streams_brands_and_products(config, stream_name, endpoint, profiles_res records = get_all_stream_records(test_stream) assert records == [] assert any([endpoint in call.request.url for call in responses.calls]) + + +@responses.activate +def test_sponsored_product_ad_group_bid_recommendations_404_error(caplog, config, profiles_response): + setup_responses(profiles_response=profiles_response) + responses.add( + responses.GET, + "https://advertising-api.amazon.com/v2/sp/adGroups/xxx/bidRecommendations", + json={"code": "404", "details": "404 Either the specified ad group identifier was not found or the specified ad group was found but no associated bid was found."}, + status=404, + ) + source = SourceAmazonAds() + streams = source.streams(config) + test_stream = get_stream_by_name(streams, "sponsored_product_ad_group_bid_recommendations") + records = get_all_stream_records(test_stream, stream_slice={'profileId': '1231', 'adGroupId': 'xxx'}) + assert records == [] + assert "Skip current AdGroup because the specified ad group has no associated bid" in caplog.text diff --git a/docs/integrations/sources/amazon-ads.md b/docs/integrations/sources/amazon-ads.md index 0955fe1e79060..884e4a8f8c817 100644 --- a/docs/integrations/sources/amazon-ads.md +++ b/docs/integrations/sources/amazon-ads.md @@ -103,6 +103,7 @@ Information about expected report generation waiting time you may find [here](ht | Version | Date | Pull Request | Subject | |:--------|:-----------|:---------------------------------------------------------|:----------------------------------------------------------------------------------------------------------------| +| 3.1.1 | 2023-08-28 | [29900](https://github.com/airbytehq/airbyte/pull/29900) | Add 404 handling for no assotiated with bid ad groups | | 3.1.0 | 2023-08-08 | [00000](https://github.com/airbytehq/airbyte/pull/00000) | Add `T00030` tactic support for `sponsored_display_report_stream` | | 3.0.0 | 2023-07-24 | [27868](https://github.com/airbytehq/airbyte/pull/27868) | Fix attribution report stream schemas | | 2.3.1 | 2023-07-11 | [28155](https://github.com/airbytehq/airbyte/pull/28155) | Bugfix: validation error when record values are missing |