googleads/google-ads-python

DNS resolution failed for googleads.googleapis.com (constant error)

pySilver opened this issue · 2 comments

Hello! I was using v13 until it was recently deprecated. Once updated to

google-api-python-client = "^2.116.0"
google-auth = "^2.27.0"
google-auth-oauthlib = "^1.2.0"
google-auth-httplib2 = "^0.2.0"
google-ads = "^23.0.0"

I'm starting to see the following error in my logs every time I try to use the API:

{
error: Error sending result: '"(1, <ExceptionInfo: Retry(Retry(...), ServiceUnavailable('DNS resolution failed for googleads.googleapis.com: C-ares status is not ARES_SUCCESS qtype=A name=googleads.googleapis.com is_balancer=0: DNS query cancelled'), 18)>, None)"'. Reason: ''TypeError("cannot pickle \'_thread.RLock\' object")''., 
exc_info: True, 
exception: <MaybeEncodingError: Error sending result: '"(1, <ExceptionInfo: Retry(Retry(...), ServiceUnavailable('DNS resolution failed for googleads.googleapis.com: C-ares status is not ARES_SUCCESS qtype=A name=googleads.googleapis.com is_balancer=0: DNS query cancelled'), 18)>, None)"'. Reason: ''TypeError("cannot pickle \'_thread.RLock\' object")''.>
}

My code is running under Docker and I can CURL to googleads.googleapis.com from both host and dockerized container at the same time.

Describe the bug:

Steps to Reproduce:

Expected behavior:

Client library version and API version:
Client library version:
Google Ads API version:

Request/Response Logs:

Anything else we should know about your project / environment:

@pySilver When you upgraded to google-ads version 23.0.0, did you also upgrade the version of grpcio you're using? Also is your application doing any multiprocessing? And does this happen if you downgrade back down to the dependencies you were using for v13? Note that you can still hit the v13 endpoints, you'll just receive an API error, which won't occur if this DNS error is happening.

Ah, sorry to such a late response. Yes, indeed the issue was resolved by setting env variable: GRPC_DNS_RESOLVER = "native" Thats a pity it is not mentioned anywhere as I don't use grpcio myself directly and it is only the dependency of this package.