Closed yash30201 closed 1 year ago
Observed that this issue started arising from version 1.7.1
of the cloud-bigtable
package. On running for 1.7.0
and below, the code snippet runs perfectly fine.
~The PR after which Bigtable started experiencing this error is: PR 3576. Observing this PR brings us to the reason of this issue:~
~This is due to the changing of fieldName from scopes
to defaultScopes
in credentialsConfig
in Gapic base clients~
Verified that this is happening in both php7.4 and php8.2
We also started seeing this error in vision library. Reverting back to 1.6.5.
Confirmed that this is happening across all the products in which APIs return a operationResponse to depict an long running process upon which that can be polled until it's completed.
The affected products(at least) are(found by searching samples which have pollUntilComplete()
):
$connection
and auth scopes are transferred here correctly as parent's scopes are also forwarded.(code pointer of instantiation)The error seems to be that scopes of parent product are not getting passed down to the long running api and thus the requests made by that long running api (essentially pollUntilComplete()
fails due to the auth error.
I'm not sure right now why the tests for these are not failing, investigating this.
Updated: The reason is that issue error arised due to a recent update in gax-php and we don't have any updates in any of these affected libraries in the past month, thus undetected. This PR helped in tracking down the reason.
I've confirmed by running tests that the related API's are running perfectly fine, hence closing this issue.
Environment details
cloud-bigtable:1.24.0
Steps to reproduce
Try any operation which returns an instance of a long running API (
\Google\ApiCore\OperationResponse
) and poll it untill completion in Bigtable's PHP client library. For eg, to create an instance, we can just try running thecreate_production_instance
sample.Code example
It's reproducible from the above code snippet.
Code
```php projectName($projectId); $instanceName = $instanceAdminClient->instanceName($projectId, $instanceId); $serveNodes = 3; $storageType = StorageType::SSD; $production = InstanceType::PRODUCTION; $labels = ['prod-label' => 'prod-label']; $instance = new Instance(); $instance->setDisplayName($instanceId); $instance->setLabels($labels); $instance->setType($production); $cluster = new Cluster(); $cluster->setDefaultStorageType($storageType); $locationName = $instanceAdminClient->locationName($projectId, $locationId); $cluster->setLocation($locationName); $cluster->setServeNodes($serveNodes); $clusters = [ $clusterId => $cluster ]; try { $instanceAdminClient->getInstance($instanceName); printf('Instance %s already exists.' . PHP_EOL, $instanceId); throw new Exception(sprintf('Instance %s already exists.' . PHP_EOL, $instanceId)); } catch (ApiException $e) { if ($e->getStatus() === 'NOT_FOUND') { printf('Creating an Instance: %s' . PHP_EOL, $instanceId); $operationResponse = $instanceAdminClient->createInstance( $projectName, $instanceId, $instance, $clusters ); $operationResponse->pollUntilComplete(); if (!$operationResponse->operationSucceeded()) { print('Error: ' . $operationResponse->getError()->getMessage()); } else { printf('Instance %s created.', $instanceId); } } else { throw $e; } } } create_production_instance( 'PROJECT_ID', 'INSTANCE_ID', 'CLUSTER_ID', 'LOCATION_ID' ); ```Error log / message
Reason of this issue
Mentioned in comment