可调用函数的网址错误

时间:2019-06-21 15:07:59

标签: firebase google-cloud-functions

因此,当我创建这样的Firebase云功能时:

exports.create_event = functions
  .region("europe-west1")
  .https
  .onCall((data, context) => {
    ... here goes my Promise ...
  });
}

然后我在App.js中初始化我的firebase内容:

import firebase from "firebase/app";

var firebaseConfig = {
  apiKey: "...",
  authDomain: "...",
  databaseURL: "...",
  appID: "..."
};

firebase.initializeApp(firebaseConfig);

然后从我的客户端应用中的另一个类中调用它:

import firebase from "firebase/app";
import "firebase/functions";

firebase
  .app()
  .functions("europe-west1")
  .httpsCallable("create_event")(somevalues)
  .then(() => {
    ...
   })
   .catch(error => console.log(error));

在浏览器中执行代码时,我看到它指向错误的URL。它实际上不调用URL europe-west-myappid.cloudfunctions ... ,而是调用以下URL:

https://europe-west1-undefined.cloudfunctions.net/create_event

它应该指定我的应用程序ID或其他名称,而不是 undefined 。我在某个地方犯错了吗?

1 个答案:

答案 0 :(得分:0)

好的,经过长时间的研究,我意识到我还没有在Firebase控制台中创建应用程序。显然,当您创建一个项目时,它尚未完成-您还必须创建应用程序,否则同样的问题也会发生在您身上。

相关问题