我正在使用NextJS和类型记录做一个Firebase项目。我正在尝试从Firestore数据库中获取数据,并且得到了这个错误Type 'Promise<QuerySnapshot<DocumentData>>' must have a '[Symbol.iterator]()' method that returns an iterator.。
下面是我用来从db中获取数据的代码
const postsRef = collection(db, "discussions");
query(postsRef, orderBy
我正在使用防火墙云功能和防火墙事务,以减少可用的产品数量的基础上购买。在部署时,它返回错误"error TS7030:并非所有代码路径都返回值“
这是代码
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
admin.initializeApp();
const db = admin.firestore()
exports.newOrder = functions.firestore
.document('ord
我的目标是在Firestore文档中使用reference数据类型从字段中获取数据。我使用嵌套的promise来获取数据。当前的代码没有等到所有的承诺都实现了。 如何让results.push( object )等到所有的承诺都实现了? 预期结果 data = {
createdDate,
expectedDate,
customer_name = "John", // name from a document in `customer` collection.
user_name = "Sherly", // name from a docu
我有这两个错误与我的每日预定功能,我试图每天检查,如果是发薪日,并添加相应的金额到每个用户的债务。 Error: Process exited with code 16
at process.on.code (invoker.js:271)
at process.emit (events.js:198)
at process.EventEmitter.emit (domain.js:448)
at process.exit (per_thread.js:168)
at Object.logAndSendError (/layers/google.nodejs.functions-framew
我有一个函数,它用:response.send("Update Last Payments Completed");正确地返回结果,但是在日志中它报告:并且没有更新任何文档。
错误:代码16退出的进程
这是我的代码:
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
/// Updates the last payment done in the neighbors documents
export const u
我是用iOS开发的,这是我第一次用打字本编码。我创建了第一个云函数,它在RTDB中发送新聊天消息时触发,并通知接收消息的成员。
当我调用Firestore以获取用户设备(userTokens)的令牌时,我没有任何错误,并且有正确的路径,但是从这些承诺返回的数据没有显示任何信息。当我记录"tokenList“时,它只是说"0”。我认为错误是当我把承诺推到一个列表或者解决它们时,但是我还没有解决它。
守则:
import * as functions from "firebase-functions"
import * as admin from "fire
我有一个函数,当有人添加评论时,应该发送通知。但日志中显示了此错误。
TypeError: result[0].data is not a function
at Promise.all.then.result (/srv/lib/index.js:19:35)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:229:7)
这是我的职责。这里面怎么了?怎样才能改变这一切?
/*eslint-disable */
const functions = re
我在云函数上部署,并得到了这个错误
Error: Cannot modify a WriteBatch that has been committed.
at WriteBatch.verifyNotCommitted (/user_code/node_modules/firebase-admin/node_modules/@google-cloud/firestore/build/src/write-batch.js:112:19)
at WriteBatch.update (/user_code/node_modules/firebase-admin/node_modules/@googl
var db=firebase.firestore();
var musicidarray=[];
var musicpaircontentarray=[];
//Retreive all music value pairs
db.collection("MusicIdNamePairs").get().then((querySnapshot) => {
querySnapshot.forEach((doc) => {
musicidarray.push(doc.id);
musicpaircontentarray.push
我尝试遍历事务数组,然后将每个事务添加到批处理中,以提交到我的firestore数据库中。
但是,我的函数是在完成批处理请求和将事务写入数据库之前完成的。
我相信我需要使用promise来等待提交我的批处理请求,但我对node.js和promises还不熟悉。
我想知道是否有人能够提供帮助,并指出在我的代码中使用promise的位置和方式,以确保批处理请求得到满足。
function saveTransactions(transactions)
{
var batch = db.batch();
var i;
for (i = 0; i < transactions.leng
我正在为构建一个私有消息传递系统,但我无法修复我的expo应用程序中存在的错误。错误是:
Firebase: No Firebase App '[DEFAULT]' has been created - call Firebase App.initializeApp() (app/no-app)
守则是:
import FirebaseKeys from "./config";
import firebase from "firebase";
require("firebase/firestore");
import { COLL
我试图获取集合中的所有文档,.forEach文档对子集合执行查询,并从其中获取最新的(按日期)文档,但出于某种原因,查询大小总是为0。
以下是代码:
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
/// Updates the last payment done in the neighbors documents
export const updateLastPaymentHTTP = functions.https.onRe