google-cloud-php: [Spanner] Running spanner emulator causes UNAUTHENTICATED error

When I try to connect to the Spanner emulator, I get the following error.

Fatal error: Uncaught Google\Cloud\Core\Exception\ServiceException: {
    "message": "Established channel does not have a sufficient security level to transfer call credential.",
    "code": 16,
    "status": "UNAUTHENTICATED",
    "details": []
} in /app/vendor/google/cloud-core/src/GrpcRequestWrapper.php:257
Stack trace:
#0 /app/vendor/google/cloud-core/src/GrpcRequestWrapper.php(146): Google\Cloud\Core\GrpcRequestWrapper->convertToGoogleException(Object(Google\ApiCore\ApiException))
#1 /app/vendor/google/cloud-core/src/GrpcTrait.php(79): Google\Cloud\Core\GrpcRequestWrapper->send(Array, Array, Array)
#2 /app/vendor/google/cloud-spanner/src/Connection/Grpc.php(301): Google\Cloud\Spanner\Connection\Grpc->send(Array, Array)
#3 /app/vendor/google/cloud-spanner/src/Instance.php(264): Google\Cloud\Spanner\Connection\Grpc->getInstance(Array)
#4 /app/vendor/google/cloud-spanner/src/Instance.php(230): Google\Cloud\Spanner\Instance->reload(Array)
#5 /app/test.php(11): Google\Cloud\Spanner\Instance->exists()
#6 {main}
  thrown in /app/vendor/google/cloud-core/src/GrpcRequestWrapper.php on line 257

This only happens with grpc v1.36. Grpc v1.35 does not have this issue.

Environment details

  • OS: Debian
  • PHP version: 7.4
  • Package name and version: grpc v1.36

Steps to reproduce

I’ve created a simple sample code to reproduce the error below.

https://github.com/taka-oyama/grpc-bug-test

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 2
  • Comments: 19 (15 by maintainers)

Most upvoted comments

@taka-oyama we fixed by downgrading grpc to version 1.35.0

sudo pecl uninstall grpc
sudo pecl install grpc-1.35.0

Hi @taka-oyama I was able to verify that this has been fixed with google/cloud-spanner:1.49 (and grpc: 1.45)

I am closing this, but if you find if it is not fixed, feel free to reopen this issue 😃

@skuruppu I was able to confirm that it works with 1.37.1. Thank you! I will close the issue.

@skuruppu it seems to work well with version 1.37.1 thanks 👍🏽

@gsouf I’m so sorry. I didn’t type in the minor version number in my comment earlier 😦

Would you please be able to try installing grpc-1.37.1?

@taka-oyama unfortunately the latest Spanner release will not fix the problem. The underlying issue is in gRPC v1.36. @larkee filed an issue in the gRPC repo (https://github.com/grpc/grpc/issues/25810). I pinged the issue just now as well.