Open JuanOG-Kyo opened 2 months ago
Hi @JuanOG-Kyo!
Creating a new http client for every request is not recommended. You would rather re-use the HttpClient. Perhaps this closed git issue would be of use. They had a similar issue to yours.
Regards,
Djoyke Adyen
Hi @JuanOG-Kyo!
Creating a new http client for every request is not recommended. You would rather re-use the HttpClient. Perhaps this closed git issue would be of use. They had a similar issue to yours.
Regards,
Djoyke Adyen
@DjoykeAbyah we use the Microsoft recommended way of using the http client factory which will reuse the connections, so i don't see how that would cause the issue.
@JuanOG-Kyo,
My apologies I wasn't aware of that! Then it's indeed very strange that you receive these error messages. I'll need to look into this a bit deeper to see what's going on. Could you maybe provide a code snippet so I can try to recreate the process?
@DjoykeAbyah This is a sample of the code we use to call TerminalRequestAsynchronousAsync() which seems to have had a couple of these exceptions occur. Note: this doesn't occur that frequently, maybe 5 times out of 3000 requests (Rough estimates).
@JuanOG-Kyo
Thank you for providing the snippet! I'll dive into it and get back to you!
We have noticed many times in production when the adyen client just randomly throws a 500 exception with Error Type: System.IO Error Message: The response ended prematurely.
Steps to reproduce the behavior: I am not sure as this occurs at random times on random days
Expected behavior A request made using the adyen client should complete the request and on any errors it should throw more meaningful exceptions or a properly structured response.
Context on how we use the client We run our app in a linux environment and we create a new adyen client on every request but we proved the httpclient from the http client factory. The primary message handler is the one produced by adyens createmessagehandler function. Which seems to be to aid with terminal requests.
Screenshot![Screenshot_20240411-000102.png](https://github.com/Adyen/adyen-dotnet-api-library/assets/66722253/d18606cf-29a5-46a0-a673-3cdb8721cbc0)