googleapis/google-cloud-php

connection was reset error when performing any CRUD to firebase firestorm

rebbieboi opened this issue · 0 comments

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

google/cloud-firestore 1.47.0
kreait/laravel-firebase 5.9.1

Steps to reproduce

when attempting to perform any CRUD it returns with an error

Code example


<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Kreait\Laravel\Firebase\Facades\Firebase;
use Google\Cloud\Firestore\FirestoreClient;

class FirebaseController extends Controller
{
    public function test()
    {
        $database = app('firebase.firestore')->database();
        $database1 = app('firebase.firestore')->database()->collection('test');
        $database2 = app('firebase.firestore')->database()->collection('test')->document(1);

        //this prints
        echo '<pre>';
        print_r($database);
        print_r($database1);
        print_r($database2);

        //this causes the error and any other attempts to perform CRUD
        $documents = app('firebase.firestore')->database()->collection('test')->documents();
    }
}

Output of the print_r above in order

Google\Cloud\Firestore\FirestoreClient Object
(
    [connection:Google\Cloud\Firestore\FirestoreClient:private] => Google\Cloud\Firestore\Connection\Grpc Object
        (
            [serializer] => Google\ApiCore\Serializer
            [firestore] => Google\Cloud\Firestore\V1\FirestoreClient
            [resourcePrefixHeader] => projects/myproject/databases/(default)
            [databaseRoutingHeader] => project_id=myproject&database_id=(default)
            [isUsingEmulator] => 
        )

    [database:Google\Cloud\Firestore\FirestoreClient:private] => (default)
    [valueMapper:Google\Cloud\Firestore\FirestoreClient:private] => Google\Cloud\Firestore\ValueMapper Object
        (
            [connection] => Google\Cloud\Firestore\Connection\Grpc
            [returnInt64AsObject] => 
        )

    [projectId:Google\Cloud\Firestore\FirestoreClient:private] => myproject
)
Google\Cloud\Firestore\CollectionReference Object
(
    [connection] => Google\Cloud\Firestore\Connection\Grpc
    [valueMapper] => Google\Cloud\Firestore\ValueMapper Object
        (
            [connection] => Google\Cloud\Firestore\Connection\Grpc
            [returnInt64AsObject] => 
        )

    [name] => projects/myproject/databases/(default)/documents/test
    [parent] => 
)
Google\Cloud\Firestore\DocumentReference Object
(
    [connection] => Google\Cloud\Firestore\Connection\Grpc
    [valueMapper] => Google\Cloud\Firestore\ValueMapper Object
        (
            [connection] => Google\Cloud\Firestore\Connection\Grpc
            [returnInt64AsObject] => 
        )

    [parent] => Google\Cloud\Firestore\CollectionReference Object
        (
            [connection] => Google\Cloud\Firestore\Connection\Grpc
            [valueMapper] => Google\Cloud\Firestore\ValueMapper Object
                (
                    [connection] => Google\Cloud\Firestore\Connection\Grpc
                    [returnInt64AsObject] => 
                )

            [name] => projects/myproject/databases/(default)/documents/test
            [parent] => 
        )

    [name] => projects/myproject/databases/(default)/documents/test/1
)

Link to the issue i posted in laravel-firebase: kreait/laravel-firebase#233

Making sure to follow these steps will guarantee the quickest resolution possible.

NOTE: checking the usage graph it shows they returned something and I was able to fetch it once but after a refresh it goes with that error again

Thanks!