anthonyjgraff commented on PR #22965:
URL: https://github.com/apache/airflow/pull/22965#issuecomment-1125496594

   @jiamo 
   
   Have spent some time looking through your traceback & having a read of the 
code
   
   You have this line in your traceback:
   
   ```
   File 
"/home/airflow/.local/lib/python3.8/site-packages/google/ads/googleads/v10/services/services/google_ads_service/client.py",
 line 3306, in search
   ```
   
   This line is only hit when:
   - We have v10 of `GoogleAdsServiceClient` (returned by 
`GoogleAdsHook._get_service`)
   - The request object isn't a v10 `SearchGoogleAdsRequest` (see line 3305 
above)
   
   As the search function creates a `SearchGoogleAdsRequest` object from the 
`GoogleAdsClient` returned by `GoogleAdsHook._get_client`, I'm guessing this 
means you've somehow got a v8 / v9 version of the client.
   
   I haven't been able to create a scenario where the service is newer than the 
request object, but I did manage to create the reverse scenario where a v10 
request object was sent to a v9 service and got the following, (which gave a 
pretty similar traceback)!
   
   ```
     File 
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/google/ads/hooks/ads.py",
 line 114, in search
       data_proto_plus = self._search(client_ids, query, page_size, **kwargs)
     File 
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/google/ads/hooks/ads.py",
 line 235, in _search
       iterator = service.search(request=request)
     File 
"/home/airflow/.local/lib/python3.8/site-packages/google/ads/googleads/v9/services/services/google_ads_service/client.py",
 line 3163, in search
       request = google_ads_service.SearchGoogleAdsRequest(request)
     File "/home/airflow/.local/lib/python3.8/site-packages/proto/message.py", 
line 496, in __init__
       raise TypeError(
   TypeError: Invalid constructor input for SearchGoogleAdsRequest: 
customer_id: "2983456428"
   query: "\n            SELECT\n                customer_client.id,\n          
      customer_client.status\n            FROM customer_client\n            
WHERE customer_client.level <= 1\n            "
   page_size: 10000
   ```
   
   In my case, I suspect the bug was caused because we don't pass 
`self.api_version` through when calling `GoogleAdsClient.load_from_dict` in the 
`GoogleAdsHook` (meaning the client defaults to the latest version, whilst the 
service correctly uses v9).
   
   From what I can tell, this behaviour long pre-dates this PR (so not sure how 
big of an issue it is with regards to 
https://github.com/apache/airflow/issues/23659), but can investigate further 
tomorrow.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to