【发布时间】:2020-10-14 17:21:26
【问题描述】:
现在这是 index.js 文件
import 'dart:math';
// The Cloud Functions for Firebase SDK to create Cloud Functions and setup triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access Cloud Firestore.
const admin = require('firebase-admin');
admin.initializeApp();
exports.getRandomNumbers=functions.https.onCall((num){
const numbers=admin.firestore().collection('RandomNumbers').document('CurrentRandomNumber');
return numbers.add({
RandomNumber=new Random().nextInt(10);
});
});
以及完成任务的功能
onPressed: (){
CloudFunctions.instance.getHttpsCallable(
functionName: "getRandomNumbers",
);
},
现在你可以看到我正在尝试获取一个随机数并将其添加到 firestore 数据库,但它既不工作也不显示任何错误。我正在使用 android studio,并且按照官方文档中的建议安装了所有东西。
【问题讨论】:
-
如果要使用functions.https.onCall需要传参数数据,只是不知道numfirebase.google.com/docs/functions/…的值是多少
-
我还有一个错误
-
'PlatformException(functionsError, Cloud function failed with exception., {code: NOT_FOUND, details: null, message: NOT_FOUND})'
-
如果可能的话帮帮我
标签: flutter google-cloud-firestore google-cloud-functions