googleads / google-ads-python

Google Ads API Client Library for Python
Apache License 2.0
526 stars 480 forks source link

Parameter to MergeFrom() must be instance of same class #849

Closed karurb92 closed 6 months ago

karurb92 commented 8 months ago

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(clickconversion)

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(clickconversion)) <class 'google.ads.googleads.v15.services.types.conversion_upload_service.ClickConversion'>

_print(clickconversion) 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:

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

BenRKarl commented 8 months ago

@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?