Firebase Hosting和Github Action出现错误"auth/invalid-api-key"

4
我正在使用React和Firebase开发项目。使用Github Actions,我的代码已经成功部署到了Firebase。
但是,当我访问托管的URL时,在控制台中会显示错误信息。
"Your API key is invalid, please check you have copied it correctly."

然而,当我直接使用firebase deploy从本地系统部署时,它可以正常工作。

我已经注意到环境变量的设置,但仍无法解决问题。

似乎在GitHub Actions将更改部署到Firebase时出现了一些问题。
尽管所有构建都通过了,但仍会出现上述错误。请帮忙解决。
enter image description here


1
你正在使用 CI Token 吗?那个从 Firebase 登录:ci 获取的。 - Ivan Chernykh
不,我是从 Firebase 控制台创建我的应用程序的。 - Tarun Singh
你在本地系统中使用 .env 文件来存储 Firebase 配置吗? - Adrian Martin
1个回答

1
这是因为GitHub actions无法访问您本地机器上的.env文件,您需要在“GitHub Secrets”中进行配置,并将其放在yml文件中。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接