googleads / google-ads-php

Google Ads API Client Library for PHP
https://developers.google.com/google-ads/api/docs/client-libs/php
Apache License 2.0
295 stars 262 forks source link

Micros gets rounded and causes API error #977

Closed mdworkin21 closed 9 months ago

mdworkin21 commented 10 months ago

Your client library and Google Ads API versions:

Your environment:

================= PHP GENERAL INFORMATION

PHP Version 8.1.26

================= PHP EXTENSION INFORMATION The PHP Extension grpc is installed: 1.44.0 The PHP Extension protobuf is installed: 3.19.4

Description of the bug: Recently I've been getting the following error when trying to update target_cpa_micros: currencyError":"VALUE_NOT_MULTIPLE_OF_BILLABLE_UNIT What seems to be happening is that the int is slightly rounded down, which changes it to a non-billable unit. Here's an example. I pass 2070000 but in the API logs it shows: 2069999, causing the error.

Steps to reproduce: This doesn't happen every time, just sporadically. It's hard to tell, but I think it only happens when the micros passed in has an odd number before the rest of the zeros.

Expected behavior: Expected behavior is that it doesn't change the micros at all, and the update goes through.

Request/Response Logs:

Screenshot 2023-12-19 at 9 47 45 AM

Anything else we should know about your project / environment:

fiboknacky commented 10 months ago

Hello there,

This doesn't happen every time, just sporadically. It's hard to tell, but I think it only happens when the micros passed in has an odd number before the rest of the zeros.

So, is it possible to reproduce the issue using this condition? And what environment are you using? Linux, Windows, or Mac?

mdworkin21 commented 10 months ago

Hi, thanks for getting back to me. We have a Linux environment.

When I said it doesn't happen everytime, I should have clarified, it doesn't happen every time we try to update a tcpa. We have been successfully doing that for a while, but this error is somewhat new. You can try to reproduce it by passing 2070000 as the target_cpa_micros, or 2030000. Those have been frequently causing issues for us.

fiboknacky commented 10 months ago

I'm using the same set of extension versions, but unfortunately, I couldn't reproduce the issue after several trials.

mdworkin21 commented 10 months ago

Hmm, ok, thank you for looking into it. Could there maybe be a problem with large integers getting rounded for some reason?

mdworkin21 commented 9 months ago

This seems to have stopped happening, though I'm not sure why (since we didn't change anything). In any case, I think we can close this.

fiboknacky commented 9 months ago

Thanks for sharing!