Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unimplemented REST method returns configuration error since 1.11.0 #370

Closed
PierrickVoulet opened this issue Jan 26, 2022 · 3 comments
Closed

Comments

@PierrickVoulet
Copy link
Contributor

PierrickVoulet commented Jan 26, 2022

Environment details

  • OS: Linux 64
  • PHP version: 8.0.1
  • Package name and version: gax-php, 1.11.0-1.11.3

Steps to reproduce

  1. Checkout the source code of google-ads-php.
  2. Go through the getting started instructions.
  3. Change the version of the dependency gax-php to 1.10.0 in the composer.json
  4. Add ->withTransport('rest') at the line number 56 of the code example GetCampaign.
  5. Run composer update
  6. Run the code example GetCampaign.
  7. It fails with the following error
PHP Fatal error:  Uncaught BadMethodCallException: Streaming calls are not supported while using the REST transport. in /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php:148
Stack trace:
#0 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php(64): Google\ApiCore\Transport\RestTransport->throwUnsupportedException()
#1 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/GapicClientTrait.php(608): Google\ApiCore\Transport\RestTransport->startServerStreamingCall()
#2 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php(61): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->Google\ApiCore\{closure}()
#3 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php(66): Google\ApiCore\Middleware\CredentialsWrapperMiddleware->__invoke()
#4 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/RetryMiddleware.php(85): Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke()
#5 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php(63): Google\ApiCore\Middleware\RetryMiddleware->__invoke()
#6 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php(66): Google\ApiCore\Middleware\OptionsFilterMiddleware->__invoke()
#7 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsExceptionMiddleware.php(61): Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke()
#8 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsResponseMetadataCallable.php(40): Google\Ads\GoogleAds\Lib\V9\ServerStreamingGoogleAdsExceptionMiddleware->__invoke()
#9 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/GapicClientTrait.php(583): Google\Ads\GoogleAds\Lib\V9\ServerStreamingGoogleAdsResponseMetadataCallable->__invoke()
#10 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/V9/Services/Gapic/GoogleAdsServiceGapicClient.php(523): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->startCall()
#11 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(105): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->searchStream()
#12 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(62): Google\Ads\GoogleAds\Examples\BasicOperations\GetCampaigns::runExample()
#13 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(121): Google\Ads\GoogleAds\Examples\BasicOperations\GetCampaigns::main()
#14 {main}
  thrown in /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Transport/HttpUnaryTransportTrait.php on line 148
  1. Change the version of the dependency gax-php to 1.11.3 in the composer.json
  2. Run composer update
  3. Run the code example GetCampaign.
  4. It fails with the following error
PHP Fatal error:  Uncaught Google\ApiCore\ValidationException: Failed to build request, as the provided path (google.ads.googleads.v9.services.GoogleAdsService/SearchStream) was not found in the configuration. in /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/RequestBuilder.php:80
Stack trace:
#0 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Transport/RestTransport.php(160): Google\ApiCore\RequestBuilder->build()
#1 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/GapicClientTrait.php(608): Google\ApiCore\Transport\RestTransport->startServerStreamingCall()
#2 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/CredentialsWrapperMiddleware.php(61): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->Google\ApiCore\{closure}()
#3 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php(66): Google\ApiCore\Middleware\CredentialsWrapperMiddleware->__invoke()
#4 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/RetryMiddleware.php(85): Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke()
#5 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/OptionsFilterMiddleware.php(63): Google\ApiCore\Middleware\RetryMiddleware->__invoke()
#6 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/Middleware/FixedHeaderMiddleware.php(66): Google\ApiCore\Middleware\OptionsFilterMiddleware->__invoke()
#7 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsExceptionMiddleware.php(61): Google\ApiCore\Middleware\FixedHeaderMiddleware->__invoke()
#8 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/Lib/V9/ServerStreamingGoogleAdsResponseMetadataCallable.php(40): Google\Ads\GoogleAds\Lib\V9\ServerStreamingGoogleAdsExceptionMiddleware->__invoke()
#9 /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/GapicClientTrait.php(583): Google\Ads\GoogleAds\Lib\V9\ServerStreamingGoogleAdsResponseMetadataCallable->__invoke()
#10 /usr/local/google/home/pierrick/git/google-ads-php/src/Google/Ads/GoogleAds/V9/Services/Gapic/GoogleAdsServiceGapicClient.php(523): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->startCall()
#11 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(105): Google\Ads\GoogleAds\V9\Services\Gapic\GoogleAdsServiceGapicClient->searchStream()
#12 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(62): Google\Ads\GoogleAds\Examples\BasicOperations\GetCampaigns::runExample()
#13 /usr/local/google/home/pierrick/git/google-ads-php/examples/BasicOperations/GetCampaigns.php(121): Google\Ads\GoogleAds\Examples\BasicOperations\GetCampaigns::main()
#14 {main}
  thrown in /usr/local/google/home/pierrick/git/google-ads-php/vendor/google/gax/src/RequestBuilder.php on line 80
  1. Notice that the error is not the same. The old error has a clear message about REST being not supported while the new one suggests that the configuration is invalid while it is not (it is just missing the configuration for REST because it was not supported before). It confuses users of older versions of libraries that accept newer versions of gax-php, see Failed to build request, as the provided path (google.ads.googleads.v9.services.GoogleAdsService/SearchStream) was not found in the configuration googleads/google-ads-php#722.
@PierrickVoulet
Copy link
Contributor Author

FYI @fiboknacky @aohren

@bshaffer
Copy link
Contributor

This is a result of the latest version of GAX supporting REST server streaming. As this is now supported, the previous exception doesn't apply. Unfortunately, old clients still won't support REST server streaming as only the latest versions of the clients will have the appropriate configuration.

We definitely considered this issue with forwards-compatibility, butWe had hoped it wouldn't effect too many users, and couldn't think of a good way to resolve it. We will try to think of a possible solution.

@bshaffer
Copy link
Contributor

Fixed in v1.11.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants