kreait / laravel-firebase

A Laravel package for the Firebase PHP Admin SDK
https://github.com/kreait/firebase-php
MIT License
992 stars 163 forks source link

Cannot fetch data from Firestore with grpc 1.24.0 #125

Closed hsumudupriya closed 1 year ago

hsumudupriya commented 2 years ago

I am trying to use this package with a Laravel backend to handle the data in Firestore database. Details of my local environment are as below.

Ubuntu 20.04.3 LTS
GNU Make 4.1
gcc 9.3.0

PHP 7.4.27
PEAR 1.10.12
grpc 1.24.0 or 1.44.0
protobuf 3.19.4

Laravel 8.83.4
kreait/laravel-firebase 4.1.0

I have created a service account in Firebase project settings and have downloaded a private key in a JSON file. And set the path of it as the value of the below environment variable.

export GOOGLE_APPLICATION_CREDENTIALS="/home/vagrant/my-project/firebase-adminsdk.json"

Then I am using Laravel tinker to fetch a document from the Firestore database.

$db = new Google\Cloud\Firestore\FirestoreClient();
$docRef = $db->collection('users')->document('047gpiOlqGRlL6gUAnwwpVTzKiR2');
$snapshot = $docRef->snapshot();

But the above script hangs running on the last line of the above code block without returning a value or throwing an error nor an exception.

The same issue occurs in the testing server with below configurations

centos-release-7-9.2009.1.el7.centos.x86_64
GNU Make 4.2 gcc (GCC) 4.8.5

PHP 7.4.28
PEAR 1.10.13
grpc 1.24.0
protobuf 3.19.4

But if I downgrade the grpc to 1.4.0 in the testing server, I can successfully fetch a document from the Firestore database. But I cannot downgrade the grpc package in my local environment to a version below than 1.24.0.

I have already spent 2 days trying to find a solution for this, trying to install grpc 1.4.0, trying to downgrade GNU Make, trying to downgrade gcc. But nothing is successfully working.

Any help is extremely appreciated. Thank you!

jeromegamez commented 2 years ago

Uh, that's tough, needing to downgrade 20 minor versions to make it work. Unfortunately there's nothing I can do from the SDK's perspective, so I would generally suggest creating an issue at https://github.com/grpc/grpc and/or https://github.com/googleapis/google-cloud-php (where the Firestore Client is from).

Could you try removing/disabling the protobuf extension? I sometimes had issues with it in the past, perhaps it could make things better for you as well 🤞

hsumudupriya commented 2 years ago

@jeromegamez Thank you for the quick response. I did try without the protobuf extension. But it didn't work.

github-actions[bot] commented 1 year ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale. Please make sure to update to the latest version and check if that solves the issue. Let me know if that works for you by leaving a 👍. Because this issue is marked as stale, it will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!