Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Cloud Functions : Failed to read credentials from file

Due to new Firebase Cloud Functions (version > 1.0). I only need to call

admin.initializeApp();

Without any parameters.

However when I did like that then run firebase deploy --only functions , this error occurred :

Failed to read credentials from file G:\projects\ANOTHER_PROJECT\ANOTHER_PROJECT.json: Error: ENOENT: no such file or directory, open 'G:\projects\ANOTHER_PROJECT\ANOTHER_PROJECT.json'

like image 403
user38931 Avatar asked Feb 15 '19 14:02

user38931


People also ask

What is the difference between Firebase CLI and cloud build?

The Firebase CLI creates a .zip archive of the function code, which is then uploaded to a Cloud Storage bucket (prefixed with gcf-sources) in your Firebase project. Cloud Build retrieves the function code and builds the function source.

What can I do with the Firebase Test SDK?

Using the shell, you mock data and perform function calls to simulate interaction with products that the Local Emulator Suite does not currently support: Cloud Storage, Pub/Sub, Analytics, Remote Config, Storage, Auth, and Crashlytics. The Firebase Test SDK for Cloud Functions, a Node.js with mocha framework for functions development.

What is Cloud Functions for Firebase?

Please try again later. Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.

How can I view and search through my Firebase logs?

You can use the Firebase console to view and search through your logs. Get started setting up, creating, and deploying functions. Learn more about what you can do with functions. Try the Cloud Functions codelab.


2 Answers

I found out the issue was that i had GOOGLE_APPLICATION_CREDENTIALS environment variable defined which was pointing to json file which did not exist and i had long deleted.

I deleted the GOOGLE_APPLICATION_CREDENTIALS env variable. Restarted the terminal and then firebase deploy --only functions worked flawlessly.

like image 114
A Paracha Avatar answered Oct 09 '22 23:10

A Paracha


In my case, I was adding the " in the path, I was using the windows terminal.

I hope it works for someone.

like image 5
jdmaldonado Avatar answered Oct 10 '22 00:10

jdmaldonado