17

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'

user38931
  • 471
  • 1
  • 6
  • 16

3 Answers3

35

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.

A Paracha
  • 904
  • 8
  • 9
5

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

I hope it works for someone.

jdmaldonado
  • 842
  • 8
  • 7
4

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

Pascal Nitcheu
  • 667
  • 7
  • 8