airbyte icon indicating copy to clipboard operation
airbyte copied to clipboard

requests.exceptions.HTTPError: 403 Client Error

Open lipan1024 opened this issue 2 years ago • 2 comments

Environment

  • Airbyte version: 0.36.0-alpha
  • OS Version / Instance: CentOS Linux release 7.6.1810
  • Deployment: docker-compose
  • Source Connector and version: (Amazon Seller Partner 0.2.16)
  • Destination Connector and version: (Postgres 0.3.17)
  • Severity: Critical
  • Step where error happened: Sync job

Current Behavior

requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://sellingpartnerapi-eu.amazon.com/reports/2020-09-04/reports

Expected Behavior

Synchronous success.

Logs

log

  2022-05-10 02:20:56 source > Encountered an exception while reading stream GET_BRAND_ANALYTICS_ALTERNATE_PURCHASE_REPORT
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 114, in read
    yield from self._read_stream(
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 159, in _read_stream
    for record in record_iterator:
  File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 248, in _read_full_refresh
    for record in records:
  File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 314, in read_records
    report_id = self._create_report(sync_mode, cursor_field, stream_slice, stream_state)["reportId"]
File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 246, in _create_report
    report_response = self._send_request(create_report_request)
  File "/usr/local/lib/python3.9/site-packages/backoff/_sync.py", line 110, in retry
    ret = target(*args, **kwargs)
  File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 194, in _send_request
    response.raise_for_status()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://sellingpartnerapi-eu.amazon.com/reports/2020-09-04/reports


Steps to Reproduce

1.reset your data 2.sync now

Are you willing to submit a PR?

Remove this with your answer.

lipan1024 avatar May 10 '22 03:05 lipan1024

We might have experienced similar issues. Do you use OAuth? Did your connector throw 403 after around 3600s?

TimothyZhang7 avatar Aug 31 '22 22:08 TimothyZhang7

Experiencing the same behaviour with another Brand Analytics report, but all the other reports for example Orders works fine.

File "/usr/local/lib/python3.9/site-packages/airbyte_cdk/sources/abstract_source.py", line 277, in _read_full_refresh for record in records: File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 339, in read_records report_id = self._create_report(sync_mode, cursor_field, stream_slice, stream_state)["reportId"] File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 271, in _create_report report_response = self._send_request(create_report_request) File "/usr/local/lib/python3.9/site-packages/backoff/_sync.py", line 105, in retry ret = target(*args, **kwargs) File "/airbyte/integration_code/source_amazon_seller_partner/streams.py", line 210, in _send_request response.raise_for_status() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://sellingpartnerapi-eu.amazon.com/reports/2020-09-04/reports 2022-09-14 07:19:03 source > Finished syncing GET_BRAND_ANALYTICS_SEARCH_TERMS_REPORT 2022-09-14 07:19:03 source > SourceAmazonSellerPartner runtimes: Syncing stream GET_BRAND_ANALYTICS_SEARCH_TERMS_REPORT 0:00:01.005918 2022-09-14 07:19:03 source > 403 Client Error: Forbidden for url: https://sellingpartnerapi-eu.amazon.com/reports/2020-09-04/reports

rainers24 avatar Sep 14 '22 07:09 rainers24

We have the same error with GET_SALES_AND_TRAFFIC_REPORT, after some tests I found that if I request a short period of time adapting Start Date and End Date in the source settings I am able to avoid the error.

dandpz avatar Oct 19 '22 13:10 dandpz

We have the same error with GET_SALES_AND_TRAFFIC_REPORT, after some tests I found that if I request a short period of time adapting Start Date and End Date in the source settings I am able to avoid the error.

Can you share the parameters with what you got the connection successful ?

rainers24 avatar Oct 25 '22 10:10 rainers24

We have the same error with GET_SALES_AND_TRAFFIC_REPORT, after some tests I found that if I request a short period of time adapting Start Date and End Date in the source settings I am able to avoid the error.

Can you share the parameters with what you got the connection successful ?

In the source we set 10000 for the field max_wait_seconds

dandpz avatar Oct 25 '22 12:10 dandpz

Should be fixed in 0.2.26. Please update to the last connector version.

lazebnyi avatar Feb 07 '23 12:02 lazebnyi