google-cloud-php
google-cloud-php copied to clipboard
Unexpectedly received this error message
Hi, I use firestore to send documents.
I unexpectedly received
Error: Undefined constant Google\Protobuf\Internal\GPBType::STRING in /firestore/vendor/google/cloud-firestore/src/V1/Document.php:199
and I cannot reproduce it, does anyone know the problem?
Here is the full stack trace
Stack trace:
#0 /firestore/vendor/google/gax/src/Serializer.php(421): Google\Cloud\Firestore\V1\Document->setFields()
#1 /firestore/vendor/google/gax/src/Serializer.php(369): Google\ApiCore\Serializer->decodeMessageImpl()
#2 /firestore/vendor/google/gax/src/Serializer.php(417): Google\ApiCore\Serializer->decodeElement()
#3 /firestore/vendor/google/gax/src/Serializer.php(127): Google\ApiCore\Serializer->decodeMessageImpl()
#4 /firestore/vendor/google/cloud-firestore/src/Connection/Grpc.php(155): Google\ApiCore\Serializer->decodeMessage()
#5 /firestore/vendor/google/cloud-firestore/src/WriteBatch.php(439): Google\Cloud\Firestore\Connection\Grpc->commit()
#6 /firestore/vendor/google/cloud-firestore/src/DocumentReference.php(184): Google\Cloud\Firestore\WriteBatch->commit()
#7 /firestore/vendor/google/cloud-firestore/src/CollectionReference.php(224): Google\Cloud\Firestore\DocumentReference->create()
#8 /firestore/Extension.php(76): Google\Cloud\Firestore\CollectionReference->add()
It seems like your project is not correctly autoloading class GPBType from the package google/protobuf. I would recommend verifying that class exists in your vendor directory.
This is a very core class to protobuf, so I do not believe this to be an error on our end. However, if you can provide more information on the issue we can verify that's the case. A few things you can do to debug:
- Run
composer info google/protobufto see what version you have - Remove the vendor directory and run
composer installto reinstall it - What version of PHP are you using? Which version of this library?
Hi @niyonx Did the steps mentioned by @bshaffer help?
Are you still seeing the error?