google-ads-php icon indicating copy to clipboard operation
google-ads-php copied to clipboard

Internal error encountered. - not catchable

Open chiragvels opened this issue 2 years ago • 18 comments

[DO NOT INCLUDE ANY PERSONAL OR SENSITIVE DATA - MAKE SURE TO REDACT CONTENT WHEN NECESSARY]

Your question: The encountered internal error is not catchable. I attempted to catch the error using various methods, but but it was not catchable. Instead, it simply breaks the cron process.

try {
     $googleAdsServiceClient = $googleAdsClient->getGoogleAdsServiceClient();
} catch (GoogleAdsException $googleAdsException) {
            throw $googleAdsException;
        } catch (ApiException $apiException) {
            throw $apiException;
        } catch (Exception $e) {
            throw $e;
        }

Private Reply by forum:

Can you confirm if you are using the PHP client library? If yes, with regards to your concern, since your concern is more on the code implementation on how to catch this kind of exception error in the Google Ads API PHP client library, you may try reaching out to the developer who maintains our client libraries PHP (Github Issues) via this link (https://github.com/googleads/google-ads-php/issues) for further insights on how to catch this kind of error.

Reference: https://groups.google.com/g/adwords-api/c/tkvPnT-fmMo/m/IYS31igSAgAJ

How I can catch error which falls under Internal error encountered.

Thanks,

chiragvels avatar Aug 11 '23 08:08 chiragvels

Hello,

May I receive some assistance here, please?

Thanks

chiragvels avatar Aug 22 '23 05:08 chiragvels

Hello Chirag,

Sorry for keeping you waiting. I didn't realize you've created this issue. Will take a look soon. By the way, you used Google Ads API v13 with grpc, correct? Would you mind sharing other information like the grpc, protobuf and gax-php version? And do you still face this issue when running the same query? (I can check your query internally, so you don't need to share it here)

Knack

fiboknacky avatar Aug 22 '23 06:08 fiboknacky

Hello Knack,

Sorry for keeping you waiting. I didn't realize you've created this issue. Will take a look soon.

  • No problem. Thanks for taking a look at this.

By the way, you used Google Ads API v13 with grpc, correct?

Yes correct.

Would you mind sharing other information like the grpc, protobuf and gax-php version?

================= PHP EXTENSION INFORMATION The PHP Extension grpc is installed: 1.54.0 The PHP Extension protobuf is installed: 3.22.3 PHP Version => 8.1.2-1ubuntu2.13 "x-goog-api-client": "gl-php/8.1.2-1ubuntu2.13 gccl/20.0.0 gapic/20.0.0 gax/1.19.1 grpc/1.54.0 rest/1.19.1 pb/3.22.3+c",

And do you still face this issue when running the same query? (I can check your query internally, so you don't need to share it here)

  • yes I am still facing issue. But It is random with different customerIds.
  • Recent request ID:"xeFxg2dKwa3-PSxNXlMIHA"

chiragvels avatar Aug 22 '23 06:08 chiragvels

Could you please also share the version of google/gax too? Thanks.

fiboknacky avatar Aug 22 '23 08:08 fiboknacky

I have also included the gax version information in my previous response.

gax/1.19.1

"name": "google/gax",
           "version": "v1.19.1",
           "source": {
               "type": "git",
               "url": "https://github.com/googleapis/gax-php.git",
               "reference": "30f6b307faa9858bf58d967664467098dbbc354f"
           },

chiragvels avatar Aug 22 '23 09:08 chiragvels

Hi Chirag,

I'm trying to reproduce the error you got, but so far I cannot do it yet.

Having said that, from the error you shared on the forum, it looks like the library should be able to recognize the error because the type is google.ads.googleads.v13.errors.googleadsfailure-bin.

Digging deeper, I think that the internal error you got probably is not an ApiException instance, and probably falls out of this if clause. And what you saw is probably just an error message thrown up from the bottom of the stack by the throw statement.

Could you help me verify this? Maybe you can add something around that if clause to check if my assumption is true. If yes, we can think about adding support for this internal error going forward. Thanks!

fiboknacky avatar Aug 23 '23 17:08 fiboknacky

Hi Knack,

Could you help me verify this? Maybe you can add something around [that if clause](https://github.com/googleads/google-ads- php/blob/e070fbdd5ef18daab3da9d4b5b148d6344efe209/src/Google/Ads/GoogleAds/Lib/V13/ServerStreamingGoogleAdsExceptionMiddleware.php#L95) to check if my assumption is true.

Yes, it is. Yesterday, I encountered an internal error. However, when I attempted to debug the issue, I was unable to reproduce the error while rerunning the same example. As a result, I'm not entirely certain about the nature of the problem.

Thanks,

chiragvels avatar Aug 25 '23 06:08 chiragvels

OK. Please let me know when you can reproduce it. For now, I suspect that somehow the internal error thrown by the server wasn't created as an instance of ApiException. And that's why the exception is thrown as is, but I still wonder why it's not at least an instance of Exception, so you can catch it.

If it's not even an Exception, we probably need to dig deeper.

fiboknacky avatar Aug 25 '23 06:08 fiboknacky

I have faced same issue again.

An uncaught Exception was encountered

Type:        Google\Ads\GoogleAds\Lib\V13\GoogleAdsException
Message:     {
    "message": "Internal error encountered.",
    "code": 13,
    "status": "INTERNAL",
    "details": [
        {
            "@type": "google.ads.googleads.v13.errors.googleadsfailure-bin",
            "data": "<Unknown Binary Data>"
        },
        {
            "@type": "grpc-status-details-bin",
            "data": "<Unknown Binary Data>"
        },
        {
            "@type": "request-id",
            "data": "SwfPxA_CISpD_3bpjNnoDA"
        }
    ]
}

I think you are right its not creating instance of ApiException.

Filename: /vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V13/GoogleAdsExceptionTrait.php
Line Number: 75

Backtrace:
	File: /vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V13/GoogleAdsExceptionTrait.php
	Line: 50
	Function: createGoogleAdsException

	File: /vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V13/ServerStreamingGoogleAdsExceptionMiddleware.php
	Line: 96
	Function: throwGoogleAdsException

	File: /vendor/googleads/google-ads-php/src/Google/Ads/GoogleAds/Lib/V13/ServerStreamingGoogleAdsResponseMetadataCallable.php
	Line: 63
	Function: readAll

Thanks,

chiragvels avatar Oct 02 '23 08:10 chiragvels

Is it not even Exception either? That would be a surprise to me.

fiboknacky avatar Oct 02 '23 10:10 fiboknacky

Yes, This is not even honoured Exception.

chiragvels avatar Oct 02 '23 12:10 chiragvels

That's weird. We may need to file a bug on the gax-php repo.

fiboknacky avatar Oct 02 '23 14:10 fiboknacky

Ok. What details must we include when filing a bug on gax-php repo.?

chiragvels avatar Oct 03 '23 04:10 chiragvels

Taking a look at your recent report again, it looks like it was thrown as Exception? So, wasn't it caught at the last catch?

fiboknacky avatar Oct 04 '23 17:10 fiboknacky

Yes, It wasn't caught at the last catch?

chiragvels avatar Oct 06 '23 12:10 chiragvels

That's quite weird, since it says that the uncaught exception is Google\Ads\GoogleAds\Lib\V13\GoogleAdsException. It should have been caught at the first catch. 🤔

fiboknacky avatar Oct 06 '23 14:10 fiboknacky

Yes, But I was getting out of loop when Internal Error encountered and cron jobs are killed.

chiragvels avatar Oct 09 '23 04:10 chiragvels

Do you still get this problem?

fiboknacky avatar Mar 18 '25 08:03 fiboknacky