【问题标题】:Firebase callable function in react native反应原生的Firebase可调用函数
【发布时间】:2020-04-15 04:44:26
【问题描述】:

是否支持与 React Native 一起使用 Firebase 可调用函数?

我部署了一个 onCall 函数,我可以在我的仪表板中看到它

我还使用

初始化了函数
 // Initialize Cloud Functions through Firebase
 firebase.functions();

我使用

调用函数
    const func = firebase.functions().httpsCallable('funcName');

    func({
        param1: '',
        param2: '',
        param3: '',
        param4: ''
    }).then(res => {
        console.log('success')
        console.log(res)
    })

但每次我拨打电话时,承诺都会被拒绝,并显示“未找到”消息

我的 firebase 版本是 7.6.1

功能代码:

  export const funcName = functions.https.onCall((data, context) => 
     {
  return { message: 'success' }
   })

【问题讨论】:

  • 请编辑问题以显示客户端和功能代码。

标签: javascript firebase react-native google-cloud-functions


【解决方案1】:

我遇到的问题来自我的 firebase 配置

 {
  apiKey: "",
  databaseURL: "",
  storageBucket: ""
 }

一旦我更新它,它就可以工作了

{

    apiKey: "",
    authDomain: "",
    databaseURL: "",
    projectId: "",
    storageBucket: "",
    messagingSenderId: "",
    appId: ""
}

【讨论】:

  • 如果您能够解决您的问题,请考虑接受您自己的答案 :)
猜你喜欢
  • 1970-01-01
  • 2021-05-28
  • 2019-01-05
  • 2019-04-23
  • 2020-02-13
  • 1970-01-01
  • 1970-01-01
  • 2018-10-28
  • 2017-10-26
相关资源
最近更新 更多