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

Invalid service account (cannot be read file) #122

Closed mantey-github closed 2 years ago

mantey-github commented 2 years ago

When I pass a full path for as my FIREBASE_CREDENTIALS Eg: FIREBASE_CREDENTIALS="https://firebasestorage.googleapis.com/v0/b/project-name.appspot.com"

I get this error

"Invalid service account: /Users/username/Project/fund-apigateway/https://firebasestorage.googleapis.com/v0/b/project-name.appspot.com can not be read: SplFileObject::__construct/Users/username/Project/fund-apigateway/https://firebasestorage.googleapis.com/v0/b/project-name.appspot.com ): failed to open stream: No such file or directory",

Laravel Framework: 8.65.0 kreait/laravel-firebase: ^4.1

jeromegamez commented 2 years ago

The URL of the file you tried to use is still visible from the history of your edited post, I recommend that you deactivate and delete the related service account immediately and generate a new one. Also, please delete the version history of your original post - if you can't do it, please let me know, then I can do it for you.

You must and can not use a remote URL as the path for your service account, especially not when it is public.

/Users/username/.../https://firebasestorage.googleapis.com... is not a valid file path because you can only use a local file path or a JSON string as the environment variable to configure the SDK.

Please follow the documentation at https://firebase-php.readthedocs.io/en/6.1.0/ to learn more about setting up the SDK or the README of https://github.com/kreait/laravel-firebase to learn about setting up the related Laravel package.

mantey-github commented 2 years ago

The URL of the file you tried to use is still visible from the history of your edited post, I recommend that you deactivate and delete the related service account immediately and generate a new one. Also, please delete the version history of your original post - if you can't do it, please let me know, then I can do it for you.

You must and can not use a remote URL as the path for your service account, especially not when it is public.

/Users/username/.../https://firebasestorage.googleapis.com... is not a valid file path because you can only use a local file path or a JSON string as the environment variable to configure the SDK.

Please follow the documentation at https://firebase-php.readthedocs.io/en/6.1.0/ to learn more about setting up the SDK or the README of https://github.com/kreait/laravel-firebase to learn about setting up the related Laravel package.

Thanks. I will delete the service account