Ecommerce Integrations (Amazon SP-API) Error v14

Getting the following traceback error with ecommerce_integrations app installed ERPNext v14. Will appreciate clarification on whether this is somehow related to our dns setup etc or the integration is attempting to reach a URL “/reports/2021-06-30/reports” which cannot be resolved.

I am able to successfully establish a SSL connection from the server using curl -v https://sellingpartnerapi-na.amazon.com - so should rule out dns setup at our end…

Bug???

Traceback below:

urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sellingpartnerapi-na.amazon.com', port=443): Max retries exceeded with url: /reports/2021-06-30/reports (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f026fdf2680>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/requests/adapters.py", line 440, in send
    resp = conn.urlopen(
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
    retries = retries.increment(
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='sellingpartnerapi-na.amazon.com', port=443): Max retries exceeded with url: /reports/2021-06-30/reports (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f026fdf2680>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 1590, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 304, in run_doc_method
    response = doc.run_method(method)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 908, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1258, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1240, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 905, in fn
    return method_object(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_sp_api_settings.py", line 46, in get_products_details
    get_products_details(amz_setting_name=self.name)
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_repository.py", line 569, in get_products_details
    return amazon_repository.get_products_details()
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_repository.py", line 462, in get_products_details
    report_id = self.create_report()
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_repository.py", line 487, in create_report
    response = reports.create_report(
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_sp_api.py", line 428, in create_report
    return self.make_request(method="POST", append_to_base_uri=append_to_base_uri, data=data)
  File "/home/frappe/frappe-bench/apps/ecommerce_integrations/ecommerce_integrations/amazon/doctype/amazon_sp_api_settings/amazon_sp_api.py", line 294, in make_request
    response = request(
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/requests/api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/requests/sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/requests/sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/requests/adapters.py", line 519, in send
    raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sellingpartnerapi-na.amazon.com', port=443): Max retries exceeded with url: /reports/2021-06-30/reports (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f026fdf2680>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py", line 47, in make_error_snapshot
    snapshot = get_snapshot(exception)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/error.py", line 140, in get_snapshot
    value = pydoc.text.repr(getattr(evalue, name))
AttributeError: characters_written

Found the source of the URL and have created an issue on Github as I think it may be incorrect: Missing hostname?

Appreciate it if someone can suggest the appropriate change to the BASE_URI (if needed) and submit a PR - so issue can be resolved quickly.