Firebase Cloud功能:无法从文件读取凭据 [英] Firebase Cloud Functions : Failed to read credentials from file
问题描述
由于新的Firebase Cloud Functions(版本> 1.0).我只需要打电话
Due to new Firebase Cloud Functions (version > 1.0). I only need to call
admin.initializeApp();
没有任何参数.
但是,当我这样做时,然后运行firebase deploy --only函数,就会发生此错误:
However when I did like that then run firebase deploy --only functions , this error occurred :
无法从文件G:\ projects \ ANOTHER_PROJECT \ ANOTHER_PROJECT.json中读取凭据:错误:ENOENT:没有此类文件或目录,请打开"G:\ projects \ ANOTHER_PROJECT \ ANOTHER_PROJECT.json"
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'
推荐答案
我发现问题是我定义了GOOGLE_APPLICATION_CREDENTIALS环境变量,该变量指向不存在的json文件,而且我早已删除.
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.
我删除了GOOGLE_APPLICATION_CREDENTIALS环境变量.重新启动终端,然后进行Firebase部署-只有功能完美无缺.
I deleted the GOOGLE_APPLICATION_CREDENTIALS env variable. Restarted the terminal and then firebase deploy --only functions worked flawlessly.
这篇关于Firebase Cloud功能:无法从文件读取凭据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!