我们正在将Firestore对象转换为新的
我们通过进口消防站在前端做得很成功。
import { firestore } from 'firebase';
然后用firestore.Timestamp替换所有日期对象类型。
startDate: firestore.Timestamp;
问题是,我似乎找不到访问节点中时间戳的方法。
我尝试过同时记录admin和functions对象,但似乎根本找不到时间戳。
import * as functions from 'firebase-functions';
import * as admin from
试图在python服务器上集成Google防火墙API
...
File "/home/daffolap-355/repos/subscriptions/appvendor/firebase_admin/firestore.py", line 28, in <module>
raise ImportError('Failed to import the Cloud Firestore library for Python. Make sure '
ImportError: Failed to import the Cloud Firest
当试图使用Firebase deploy部署我的Firebase函数时,我会得到以下错误:
Error: Error occurred while parsing your function triggers.
Error: Failed to initialize Google Cloud Firestore client with the available credentials. Must initialize the SDK with a certificate credential or application default credentials to use Cloud F
我想在客户端使用类似serverTimestamp方法的东西,但要做到这一点,我需要包含firebase-admin包,这会增加客户端包的大小。
import * as firebaseAdmin from "firebase-admin";
if (!firebaseAdmin.apps.length) {
firebaseAdmin.initializeApp();
}
const firebaseTimestamp = firebaseAdmin.firestore.FieldValue.serverTimestamp();
const initDate = fi
我正在为admin.firestore.FieldValue.serverTimestamp()获取一个空对象,下面是存储在Firestore中的文档的屏幕截图:
下面是创建消息对象的代码(对应于上面的截图):
import {Message} from "./Message";
import {MessageType} from "./MessageType";
import * as admin from "firebase-admin";
export class TextMessage extends Message {
我在Firebase上运行一个web应用程序,我从实时数据库开始,现在我正在将我的数据迁移到firestore。 我使用admin SDK迁移了除时间戳以外的所有其他数据。在我的web应用程序中,当用户上传新内容时,代码会将时间戳添加到数据库中,这样内容就可以按时间排序。 问题是实时数据库和firestore显然在记录时间戳时使用了不同的方法: firebase.database.ServerValue.TIMESTAMP // This will be in the following format: 1577778747131
firebase.firestore.Timestamp.
我想知道为什么时间戳对象没有像我预期的那样工作?
它在测试环境中工作(我使用Mocha),但是当它被部署时会抛出错误。
index.ts
import { Timestamp, QuerySnapshot } from "@google-cloud/firestore";
....
async someFunction() {
let col = firestore.collection("mycollection");
let now = Timestamp.now();
let twentyMinsAgo = Timestamp.from
我正在尝试解决一个看起来应该很容易解决的问题,但我在文档中找不到任何关于它的东西,而且似乎没有任何关于它的问题。 我正在用React Native构建一个应用程序,在那里我们创建与应用程序相关的各种文档,并将这些文档发送到Firebase函数,该函数运行一个快速服务器,该服务器使用node@10的Admin SDK连接到Firestore。我的问题是试图找到一些合理的方法来表示日期,而不必每次来回转换所有内容,因为在我的文档/子文档中有相当多的日期字段。我在这里用import * as firebase from firebase和firebase.initializeApp(...conf
我正在尝试将一条消息发送到Firebase函数中的FCM主题,该主题是在创建Firestore文档(消息)时触发的。订阅主题(也使用函数完成)并触发send函数运行良好,但实际发送失败的原因如下:
Error: An error occurred when trying to authenticate to the FCM servers. Make sure the credential used to authenticate this SDK has the proper permissions. See https://firebase.google.com/docs/admin/se
我试图在我的google云函数中获取Firestore文档,但是Firebase Admin SDK抛出了一个错误,我不确定如何修复Admin SDK库中的错误。我已经将firebase-admin依赖项更新到^8.0.0,但没有用。
TypeError: this._firestore.getAll is not a function at DocumentReference.get
(***/functions/node_modules/@google-cloud/firestore/build/src/reference.js:198:32) at updateClaims (***/
这个错误发生在我更新了firebase函数和firebase-admin之后
"firebase-functions": "^2.0.4",
"firebase-admin": "^6.0.0"
完全错误
Error: Error occurred while parsing your function triggers.
Error: Failed to import the Cloud Firestore client library for Node.js. Make sure to install the "@g
我一直试图向主题"All“发送一个标识,控制台日志显示了错误:
发送的通知失败: TypeError: admin.messaging不是函数
代码:
// The Cloud Functions for Firebase SDK to create Cloud Functions and set up triggers.
const functions = require('firebase-functions');
// The Firebase Admin SDK to access Firestore.
var admin = require("fi
是否可以使用服务器的时间戳来过滤Firestore查询?当尝试执行查询时,例如: firebase.app.firestore()
.collection('posts')
.where('timestamp', '<=', firebase.firestore.FieldValue.serverTimestamp()) 抛出以下错误。 FirebaseError: Function Query.where() called with invalid data. FieldValue.serverTimestamp() can o