错误获取访问令牌firebase云功能

发布于 2025-02-13 03:02:06 字数 757 浏览 2 评论 0原文

我正在尝试使用firebase部署 - 仅函数来部署我的firebase云功能。我的功能确实已成功部署,但是我在控制台中收到此警告消息:

@firebase/数据库:firebase警告: {“代码”:“应用程序/无效 - 信用”,“消息”:“凭据实现 通过“凭据”属性提供给初始化的()未能 获取有效的Google OAuth2访问令牌,并带有以下错误: “错误获取访问令牌:提出请求时错误:getAddrinfo enotfound Metadata.google.internal。错误代码:enotfound“。”}

这是我在index.ts的顶部所拥有的:

import * as functions from "firebase-functions";
import * as admin from "firebase-admin";

admin.initializeApp({
    credential: admin.credential.applicationDefault(),
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
});

我已经完成了export google_application_credentials =“/path/path/to/to/service-acccount-file。 JSON“

我如何摆脱此警告信息?

I am trying to deploy my Firebase Cloud Functions using firebase deploy --only functions. My functions do get successfully deployed, but I get this warning message in the console:

@firebase/database: FIREBASE WARNING:
{"code":"app/invalid-credential","message":"Credential implementation
provided to initializeApp() via the "credential" property failed to
fetch a valid Google OAuth2 access token with the following error:
"Error fetching access token: Error while making request: getaddrinfo
ENOTFOUND metadata.google.internal. Error code: ENOTFOUND"."}

This is what I have at the top of my index.ts:

import * as functions from "firebase-functions";
import * as admin from "firebase-admin";

admin.initializeApp({
    credential: admin.credential.applicationDefault(),
    databaseURL: "https://<DATABASE_NAME>.firebaseio.com",
});

I have done export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account-file.json".

How do I get rid of this warning message?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文