小编Ann*_*eke的帖子

Firebase function - query firestore

Im trying to retrieve some data from firestore within a cloud function, but get nothing back. The same query on the client-side gives me the correct results. It's probably something small but I don't see the issue. What am I doing wrong?

const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp();
const db = admin.firestore();
db.settings({ timestampsInSnapshots: true });

exports.myFunction = functions.https.onCall((data, context) => {
  const info = getInfo();
  //do some stuff with the info
  return info;
}

function getInfo() …
Run Code Online (Sandbox Code Playgroud)

firebase google-cloud-functions google-cloud-firestore

2
推荐指数
1
解决办法
3058
查看次数