18

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'

3
  • You're going to have to give more information about how you're running the code. Please give the exact steps that anyone can use to reproduce the problem. Commented Feb 15, 2019 at 14:19
  • I ran the app by using firebase deploy --only functions Commented Feb 16, 2019 at 2:52
  • When doing the mandatory upgrade from Node 6 to Node 8 I am running into the same issue. Commented Apr 24, 2019 at 16:50

3 Answers 3

37

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.

Sign up to request clarification or add additional context in comments.

2 Comments

How did you deleted it ?
Never mind, I just saw it's shell. Just need to use unset VAR_NAME
6

If you have set the GOOGLE_APPLICATION_CREDENTIALS env variable right then just close the terminal and open a new one since the changes you have applied are not always taken into consideration in the current terminal

1 Comment

For local dev: this plus using a full path instead of relative path was the answer for me.
5

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

I hope it works for someone.

1 Comment

where did you add what exactly?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.