socket hang up error
# 🤝help
b
Hi, We are calling an API from the Before_Outgoing hook. However, we randomly get the following error: {"message":"socket hang up","name":"Error","stack":"Error: socket hang up\n at gm.from (/var/task/customer_code.js:195:181815) ..................... "code":"ECONNRESET","status":null} The calling code is a simple Axios post. Is there any specific minimum response time that has been setup on your end to cause this perhaps? We are optimizing as much as we can on our end at the API enpoint, and we also aren't seeing any errors in the IIS logs on our API side to suggest we are dropping the connection. Any ideas or help would be greatly appreciated.
f
Hey there, How long does it take to respond when calling it from something like PostMan or Insomnia?
b
Hi there. Just over 1000 ms
f
Weird. What happens if you do the same API call from an execute code card instead of a hook?
b
I can try test that. But it would be cumbersome to add a card after every bot response if that works.... I'm also looking to perhaps use some kind of fire and forget in our API so that we can return an OK response as quickly as possible to the API call in the Before_Outgoing hook. Was really interested if there was a hard ceiling on Botpress' side to process the response 🤷
We're going to try increasing the timeout in the axios call to see if that helps. Thanks for the response Decay
f
It would just be a test from the execute code card, not to replace it. I really don't think 1 second is the reason why its throwing that error.
b
I hear you. I'll get someone to do a test and revert here. As a thought experiment we are also considering moving the various endpoints to separate minimal API microservices so that each endpoint has it's own app pool (We use dotnet in IIS...). We have other statusing endpoints that might be stealing threads from the main API that botpress calls.