Skip to content

Commit c05c70b

Browse files
authored
Source Google Analytics v4: fix empty response error (#37432)
Signed-off-by: Artem Inzhyyants <[email protected]>
1 parent 9aeb5b6 commit c05c70b

File tree

6 files changed

+17
-11
lines changed

6 files changed

+17
-11
lines changed

airbyte-integrations/connectors/source-google-analytics-v4-service-account-only/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ data:
1313
connectorSubtype: api
1414
connectorType: source
1515
definitionId: 9e28a926-8f3c-4911-982d-a2e1c378b59c
16-
dockerImageTag: 0.0.1
16+
dockerImageTag: 0.0.2
1717
dockerRepository: airbyte/source-google-analytics-v4-service-account-only
1818
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4-service-account-only
1919
githubIssueLabel: source-google-analytics-v4-service-account-only

airbyte-integrations/connectors/source-google-analytics-v4/metadata.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ data:
1313
connectorSubtype: api
1414
connectorType: source
1515
definitionId: eff3616a-f9c3-11eb-9a03-0242ac130003
16-
dockerImageTag: 0.3.0
16+
dockerImageTag: 0.3.1
1717
dockerRepository: airbyte/source-google-analytics-v4
1818
documentationUrl: https://docs.airbyte.com/integrations/sources/google-analytics-v4
1919
githubIssueLabel: source-google-analytics-v4

airbyte-integrations/connectors/source-google-analytics-v4/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ requires = [ "poetry-core>=1.0.0",]
33
build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
6-
version = "0.3.0"
6+
version = "0.3.1"
77
name = "source-google-analytics-v4"
88
description = "Source implementation for Google Analytics V4."
99
authors = [ "Airbyte <[email protected]>",]

airbyte-integrations/connectors/source-google-analytics-v4/source_google_analytics_v4/source.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,8 @@ def get_refresh_request_params(self) -> Mapping[str, Any]:
533533
class TestStreamConnection(GoogleAnalyticsV4Stream):
534534
"""
535535
Test the connectivity and permissions to read the data from the stream.
536-
Because of the nature of the connector, the streams are created dynamicaly.
537-
We declare the static stream like this to be able to test out the prmissions to read the particular view_id."""
536+
Because of the nature of the connector, the streams are created dynamically.
537+
We declare the static stream like this to be able to test out the permissions to read the particular view_id."""
538538

539539
page_size = 1
540540

@@ -552,7 +552,11 @@ def stream_slices(self, stream_state: Mapping[str, Any] = None, **kwargs: Any) -
552552

553553
def parse_response(self, response: requests.Response, **kwargs: Any) -> Iterable[Mapping]:
554554
res = response.json()
555-
return res.get("reports", {})[0].get("data")
555+
try:
556+
return res.get("reports", [])[0].get("data")
557+
except IndexError:
558+
self.logger.warning(f"No reports in response: {res}")
559+
return []
556560

557561

558562
class SourceGoogleAnalyticsV4(AbstractSource):

docs/integrations/sources/google-analytics-v4-service-account-only.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,9 @@ The Google Analytics connector should not run into the "requests per 100 seconds
279279

280280
## Changelog
281281

282-
| Version | Date | Pull Request | Subject |
283-
|:--------|:-----------|:----------------------------------------------------------|:----------------|
284-
| 0.0.1 | 2023-01-22 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Initial Release |
282+
| Version | Date | Pull Request | Subject |
283+
|:--------|:-----------|:---------------------------------------------------------|:-----------------------------------------|
284+
| 0.0.2 | 2024-04-19 | [37432](https://github.com/airbytehq/airbyte/pull/36267) | Fix empty response error for test stream |
285+
| 0.0.1 | 2024-01-29 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Initial Release |
285286

286287
</HideInUI>

docs/integrations/sources/google-analytics-v4.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ The Google Analytics connector should not run into the "requests per 100 seconds
282282
## Changelog
283283

284284
| Version | Date | Pull Request | Subject |
285-
|:--------| :--------- | :------------------------------------------------------- | :------------------------------------------------------------------------------------------- |
286-
| 0.3.0 | 2024-03-19 | [36267](https://github.com/airbytehq/airbyte/pull/36267) | Pin airbyte-cdk version to `^0` |
285+
|:--------|:-----------|:---------------------------------------------------------|:---------------------------------------------------------------------------------------------|
286+
| 0.3.1 | 2024-04-19 | [37432](https://github.com/airbytehq/airbyte/pull/36267) | Fix empty response error for test stream |
287+
| 0.3.0 | 2024-03-19 | [36267](https://github.com/airbytehq/airbyte/pull/36267) | Pin airbyte-cdk version to `^0` |
287288
| 0.2.5 | 2024-02-09 | [35101](https://github.com/airbytehq/airbyte/pull/35101) | Manage dependencies with Poetry. |
288289
| 0.2.4 | 2024-01-22 | [34323](https://github.com/airbytehq/airbyte/pull/34323) | Update setup dependencies |
289290
| 0.2.3 | 2024-01-18 | [34353](https://github.com/airbytehq/airbyte/pull/34353) | Add End date option |

0 commit comments

Comments
 (0)