Peleg
Peleg

Reputation: 159

call to external API is getting blocked on Google Cloud Run

I run a Backend written in Python and deployed on Google Cloud Run.For its activity it calls several other API services. The post request to most services works fine, but for one of them, the same code that works fine on my PC, raises an error running in Cloud Run environment. This is a service that has an HTTPS address or an alternative HTTP address and both options are blocked when I try to call from Cloud Run. I use the following line of code:

self.rx_xml = requests.post(url,self.tx_xml).text

Result (from Cloud Run only):

HTTPSConnectionPool(host='secureapi.soprano.co.il', port=443): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x3eb0b155ebb0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

Or for the alternative address:

HTTPConnectionPool(host='api.soprano.co.il', port=80): Max retries exceeded with url: / (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x3e10f4f1dbb0>: Failed to establish a new connection: [Errno 110] Connection timed out'))

Because this is a local company, the first thing I thought about is that their firewall blocks any IP from outside the country (Israel). In conversations with their customer service they have insisted and again that they are open to the whole world and no IP address is blocked, and they advise me to check if any setting in Cloud Run environment blocks access to them. This sounds very strange to me because access to other addresses works, but since they insist I would be happy to make sure:

  1. Does Cloud Run block access to some outbound connection? Is there a way to see the settings of this block and change them?
  2. Is there a way to clearly check where the connection is blocked?

Upvotes: 2

Views: 2782

Answers (1)

Peleg
Peleg

Reputation: 159

As guillaume blaquiere said, Cloud run should not block any outgoing request. If there is a problem it is probably because the destination to which the request is sent is blocking the IP address, for example because it is from abroad. Continuing to insist on customer service solved the problem. Thank!

Upvotes: 2

Related Questions