You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
results in CredentialsLoader.php->makeCredentials($scope, array $jsonKey) throwing an error:
array_key_exists() expects parameter 2 to be array, string given
The service account credentials can be converted to an associative array to resolve the issue, however the definition of keyFile as a string in ServiceBuilder.php differs from its treatment in CredentialsLoader.php.
As an aside or possibly separate issue, when CredentialsLoader.php->makeCredentials($scope, array $jsonKey) calls new return new ServiceAccountCredentials($scope, $jsonKey);, /src/Credentials/ServiceAccountCredentials.php treats $jsonKey as potentially being a filename:
if (is_string($jsonKey)) {
if (!file_exists($jsonKey)) {
throw new \InvalidArgumentException('file does not exist');
}
indicating that if keyFile is provided as a string, it is treated as a filename rather than a string to be converted to an associative array.
The text was updated successfully, but these errors were encountered:
This looks like a mistake on our part and the correct type is (as you discovered) array. I've opened a PR to address this, thanks for the thorough report and bringing it to our attention :).
@dwsupplee's change also updated the documentation in each of those files. We just tagged v0.20.1, so you should see the updated documentation on our docs site in a few minutes.
ServiceBuilder.php describes the config keyFile option with:
Providing the contents of the service account credentials as a string, however, with:
results in CredentialsLoader.php->makeCredentials($scope, array $jsonKey) throwing an error:
The service account credentials can be converted to an associative array to resolve the issue, however the definition of keyFile as a string in ServiceBuilder.php differs from its treatment in CredentialsLoader.php.
As an aside or possibly separate issue, when CredentialsLoader.php->makeCredentials($scope, array $jsonKey) calls
new return new ServiceAccountCredentials($scope, $jsonKey);
, /src/Credentials/ServiceAccountCredentials.php treats $jsonKey as potentially being a filename:indicating that if keyFile is provided as a string, it is treated as a filename rather than a string to be converted to an associative array.
The text was updated successfully, but these errors were encountered: