The problem statement deals with following scenario. I am trying to run a cloud run function from gcp platform that eventually accesses an external api. The cloud run function has a python code that accesses this external REST api (). The purpose of the function is to help fetching the response data (if request and response worked fine) & getting this "content" in a .csv file thus to finally move to a cloud storage that is created. However, the issue encountered here is, the cloud run function is ended up with throwing following error, for example
requests.exceptions.ConnectionError: HTTPConnectionPool(host='10.109.21.177', port=8097): Max retries exceeded with url: /auth/realms/ocs-tenant-1/protocol/openid-connect/token (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x3e04029addf0>: Failed to establish a new connection: [Errno 110] Connection timed out'))
As the message indicates, the time out error may be originated from a network issue (though very generic indeed) which could have several reasons. When same REST api () was accessed from local virtual machines, it worked fine and the required response (200) and response body both were obtained.
Few other details
From general configurations perspective (of having maximized time out settings | or having secured permissions etc.) all aspects were ensured. However, from network setting perspective, is there any measure to be taken care in lieu with VPC connector and/or NAT gateway to help resolving this? Any pointer and /or links on this is highly appreciated.
Hi @prasit_m,
Welcome to Google Cloud Community!
The error you’re seeing happens when your application tries to set up a new TCP connection to a remote host, but it’s taking too long to connect.
For a complete troubleshooting guide on Cloud run issues, you may refer to this documentation.
I hope the above information is helpful.