Opteo/google-ads-node

Incorrect definition for bid_modifier at campaign criterion

rattlesnake2478 opened this issue · 3 comments

I'm submitting a ...

  • bug report
  • feature request
  • question about the decisions made in the repository
  • question about how to use this project

Summary

The bid_modifier field in the campaign_crtierion struct has an incorrect definition.
Current definition is { value: number }. The definition should be just number.
At the moment if you try to perform any operation with campaign_criterion with bid modifier usage - it fails with assertion error.

Other information

{ AssertionError: Assertion failed
at new goog.asserts.AssertionError (/app/node_modules/google-protobuf/google-protobuf.js:81:876)
at Object.goog.asserts.doAssertFailure_ (/app/node_modules/google-protobuf/google-protobuf.js:82:257)
at Object.goog.asserts.assert (/app/node_modules/google-protobuf/google-protobuf.js:83:83)
at jspb.BinaryEncoder.writeFloat (/app/node_modules/google-protobuf/google-protobuf.js:466:384)
at jspb.BinaryWriter.writeFloat (/app/node_modules/google-protobuf/google-protobuf.js:489:142)
at proto.google.protobuf.FloatValue.serializeBinaryToWriter (/app/node_modules/google-protobuf/google/protobuf/wrappers_pb.js:447:12)
at jspb.BinaryWriter.writeMessage (/app/node_modules/google-protobuf/google-protobuf.js:491:336)
at proto.google.ads.googleads.v2.resources.CampaignCriterion.serializeBinaryToWriter (/app/node_modules/google-ads-node/build/protos/google/ads/googleads/v2/resources/campaign_criterion_pb.js:1:14157)
at jspb.BinaryWriter.writeMessage (/app/node_modules/google-protobuf/google-protobuf.js:491:336)
at proto.google.ads.googleads.v2.services.CampaignCriterionOperation.serializeBinaryToWriter (/app/node_modules/google-ads-node/build/protos/google/ads/googleads/v2/services/campaign_criterion_service_pb.js:1:12066)
at jspb.BinaryWriter.writeRepeatedMessage (/app/node_modules/google-protobuf/google-protobuf.js:504:385)
at Function.proto.google.ads.googleads.v2.services.MutateCampaignCriteriaRequest.serializeBinaryToWriter (/app/node_modules/google-ads-node/build/protos/google/ads/googleads/v2/services/campaign_criterion_service_pb.js:1:6297)
at proto.google.ads.googleads.v2.services.MutateCampaignCriteriaRequest.serializeBinary (/app/node_modules/google-ads-node/build/protos/google/ads/googleads/v2/services/campaign_criterion_service_pb.js:1:5992)
at serialize_google_ads_googleads_v2_services_MutateCampaignCriteriaRequest (/app/node_modules/google-ads-node/build/protos/google/ads/googleads/v2/services/campaign_criterion_service_grpc_pb.js:1:2147)
at Object.final_requester.sendMessage (/app/node_modules/grpc/src/client_interceptors.js:807:37)
at InterceptingCall._callNext (/app/node_modules/grpc/src/client_interceptors.js:419:43)
 message: 'Assertion failed',
 reportErrorToServer: true,
 messagePattern: 'Assertion failed'}

Hello!
Issue is still appearing in 1.15.

Trying to make such a call:

customer.campaignCriteria.update({
    resource_name: criteriaItem.campaign_criterion.resource_name,
    bid_modifier: 0 as any, // error in typings
});

Producing following error:

TypeError: valueType.startsWith is not a function
    at toProtoValueFormat (/usr/src/app/node_modules/google-ads-node/build/lib/utils.js:101:19)
    at unroll (/usr/src/app/node_modules/google-ads-node/build/lib/utils.js:90:19)
    at Object.convertToProtoFormat (/usr/src/app/node_modules/google-ads-node/build/lib/utils.js:86:26)
    at GoogleAdsClient.buildResource (/usr/src/app/node_modules/google-ads-node/build/lib/client.js:86:41)
    at GrpcClient.buildResource (/usr/src/app/node_modules/google-ads-api/build/grpc.js:121:28)
    at CampaignCriterionService.buildResource (/usr/src/app/node_modules/google-ads-api/build/services/service.js:211:32)
    at CampaignCriterionService.<anonymous> (/usr/src/app/node_modules/google-ads-api/build/services/service.js:69:33)
    at Generator.next (<anonymous>)
    at /usr/src/app/node_modules/google-ads-api/build/services/service.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/src/app/node_modules/google-ads-api/build/services/service.js:4:12)
    at CampaignCriterionService.serviceUpdate (/usr/src/app/node_modules/google-ads-api/build/services/service.js:59:16)
    at CampaignCriterionService.<anonymous> (/usr/src/app/node_modules/google-ads-api/build/services/campaign_criterion.js:49:25)
    at Generator.next (<anonymous>)
    at /usr/src/app/node_modules/google-ads-api/build/services/campaign_criterion.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/usr/src/app/node_modules/google-ads-api/build/services/campaign_criterion.js:4:12)
    at CampaignCriterionService.update (/usr/src/app/node_modules/google-ads-api/build/services/campaign_criterion.js:48:16)

Hi @markoffk, we've just released a hot fix for this in google-ads-node 1.15.2. This change should be upstreamed into google-ads-api within hours of this comment, so make sure to look out for a new release over there. 👍

Let us know if you have any other problems!

@kritzware Thanks! It works now.