googleads/google-ads-python

Parameter to MergeFrom() must be instance of same class

karurb92 opened this issue · 1 comments

Hi,
I suddenly started getting the following error in my pipeline today.

Describe the bug:
I am running offline click conversion upload according to:
https://github.com/googleads/google-ads-python/blob/bcee4d08df0ea037d695d1bbcb595d7ee8adf9cd/examples/remarketing/upload_offline_conversion.py

The line:
request.conversions.append(click_conversion)

throws an error:

_TypeError Traceback (most recent call last)
File , line 3
1 request = client.get_type("UploadClickConversionsRequest")
2 request.customer_id = customer_id
----> 3 request.conversions.append(click_conversion)
4 request.partial_failure = True
5 conversion_upload_response = conversion_upload_service.upload_click_conversions(
6 request=request,
7 )

TypeError: Parameter to MergeFrom() must be instance of same class: expected google.ads.googleads.v15.services.ClickConversion got ClickConversion._

However, click_conversion is initiated according to the script.

print(type(click_conversion))
<class 'google.ads.googleads.v15.services.types.conversion_upload_service.ClickConversion'>

print(click_conversion)
external_attribution_data {
external_attribution_credit: 1.0
external_attribution_model: "last_google_ads_click"
}
gclid: "xxx"
conversion_action: "customers/123/conversionActions/123"
conversion_date_time: "2024-03-04 11:10:03+00:00"
conversion_value: 1.10
currency_code: "EUR"
consent {
ad_user_data: GRANTED
}

Additional info:

  • Problem started occurring only today (I have a scheduled pipeline calling API on a daily basis). Nothing with regards to runtime, code, or data has changed on my side.
  • Consent part is being added to the object correctly (for couple of days already, it was working fine).
  • Problem persists for both v15 and v16

Client library version and API version:
Python 3.10.12
google-ads 23.1.0
google-api-core 2.17.1
google-auth 2.28.1
google-auth-oauthlib 1.2.0
googleapis-common-protos 1.56.4
grpcio 1.62.0
grpcio-status 1.62.0
proto-plus 1.23.0
protobuf 4.25.3

@karurb92 I'm having trouble reproducing this issue. Can you clarify what you have set for the use_proto_plus configuration? And are you setting this configuration in multiple places?

Also, are you running the code in this example or have you made any modifications to it?