Open hcvdwerf opened 8 months ago
That's odd. I'm a bit of a noob on both Azure and Python, but is there a way for you to confirm which stage exactly times out? I'm getting some DNS vibes, as we have a discussion around mysterious DNS problems in mollie/mollie-api-php#578 spanning multiple years now.
Read timeout
kinda reads like it's all resolved and connection was established, though.
That's odd. I'm a bit of a noob on both Azure and Python, but is there a way for you to confirm which stage exactly times out? I'm getting some DNS vibes, as we have a discussion around mysterious DNS problems in mollie/mollie-api-php#578 spanning multiple years now.
Read timeout
kinda reads like it's all resolved and connection was established, though.
Which stage you mean? Thanks for your reply!
Ah, sorry for being unclear. Do you have any way of identifying which step exactly fails, specifically whether it's the DNS lookup. The error message doesn't sound like it, but I want to be sure.
Just to make sure that it's not a problem with Azure, could you verify that this only happens when sending a request to Mollie by sending a request to a different API? For quickly testing this, you could use https://httpbin.org/post to mimic a POST request.
@hcvdwerf Any progress? The ReadTimeoutError
means that you sent a request which was acknowledged by a server, but no response is coming back from that server. This is way past the DNS stage, so no issues there.
Maybe Azure has some kind of weird outbound proxy setup that interferes?
@fjbender We have the same issue since we upgraded from 2.12.0 to 3.6.0. Sometimes we get the said error when receiving a mollie webhook and the error happens exactly when we are try to fetch the related payment with client.payments.get(payment_id)
. We cannot find any similarities between the requests involved and it also happens at different times but not each time but each time at the same point I mentioned above. Our Python version was upgraded from 3.7 to 3.10.
RequestError: Unable to communicate with Mollie: HTTPSConnectionPool(host='api.mollie.com', port=443): Max retries exceeded with url: /v2/payments/tr_xxx (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mollie.com', port=443): Read timed out. (read timeout=5)"))
File "xyy", line 512, in fetch_payment
return client.payments.get(payment_id)
File "mollie/api/resources/payments.py", line 44, in get
return super().get(resource_id, **params)
File "mollie/api/resources/base.py", line 97, in get
result = self.perform_api_call(self.REST_READ, path, params=params)
File "mollie/api/resources/base.py", line 42, in perform_api_call
resp = self.client.perform_http_call(http_method, path, data, params, idempotency_key)
File "mollie/api/client.py", line 276, in perform_http_call
return self._perform_http_call_apikey(
File "mollie/api/client.py", line 227, in _perform_http_call_apikey
raise RequestError(f"Unable to communicate with Mollie: {err}")
@sommejan @hcvdwerf Did you try the suggestion that @geertjanvdenbosch gave? What is the outcome when you run a script like the one below, in a similar environment as where you would create the payment at Mollie?
import logging
import time
import requests
logging.basicConfig(
level=logging.DEBUG,
format="%(asctime)s %(levelname)s %(name)s %(message)s",
)
start = time.monotonic()
resp = requests.post("https://httpbin.org/post", json={"foo": "bar"})
end = time.monotonic()
logging.info(f"HTTP response {resp} received after {end - start} seconds")
logging.info(f"HTTP response payload: {resp.json()}")
Note that in the v3 client, a client timeout and retry mechanism was added. This should not interfere with a request to the Mollie API under normal conditions, but can be tuned if needed.
@whyscream Yes, we don't have issues with other APIs. The script you provided got me a response received in 0.5265... seconds
We have the exact same problem... When trying the call 10 times it might give the timeout 7 out of 10 and 3 times without a problem. Python 3.10.12 and mollie-api-python version 3.6.0.. We have so far been unable to pinpoint what the trigger might be for the timeout.
@whyscream when trying the above mentioned code we also instantly get a successful response.
Below our error code (tr_ was replaced with xxx)
mollie.api.error.RequestError: Unable to communicate with Mollie: HTTPSConnectionPool(host='api.mollie.com', port=443): Max retries exceeded with url: /v2/payments?from=tr_xxxxxxxx&limit=50 (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mollie.com', port=443): Read timed out. (read timeout=10)"))
Hi @ErikNL81, @sommejan and @hcvdwerf,
We're investigating the issue and we'll let you know when we know more what's causing this behaviour and possible fixes.
Hi,
any updates on this issue? We are facing the same problem (mollie-api-python 3.6.0 and Python 3.12). Could not identify anything that causes that error on our side so far.
Thanks in advance!
In azure I am running a simple mollie api and I got the following error:
mollie.api.error.RequestError: Unable to communicate with Mollie: HTTPSConnectionPool(host='api.mollie.com', port=443): Max retries exceeded with url: /v2/payments/xxxx. (Caused by ReadTimeoutError("HTTPSConnectionPool(host='api.mollie.com', port=443): Read timed out. (read timeout=10)"))
The fist attempt nearly always fail. Second succeed. What happens here? See code snippet bellow:
` unique_id = str(ObjectId())