小编RJC*_*RJC的帖子

无法在 firebase-functions 上运行摩卡测试,[ERR_PACKAGE_PATH_NOT_EXPORTED]:包子路径“./lib/encoder”不是由“exports”定义的

当我尝试在 Firebase 函数目录中运行 Mocha 测试脚本时,出现以下错误:

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './lib/encoder' is not defined by "exports" in /Users/[...redacted...]/functions/node_modules/firebase-functions/package.json
Run Code Online (Sandbox Code Playgroud)

我使用的是 Node 12,我的 devDependency 是:

{
    "chai": "^4.2.0",
    "firebase-functions": "^3.18.1",
    "firebase-functions-test": "^0.2.3",
    "mocha": "^8.4.0"
}
Run Code Online (Sandbox Code Playgroud)

javascript mocha.js firebase google-cloud-functions

8
推荐指数
1
解决办法
710
查看次数

Firebase Cloud Functions 上“尝试向 FCM 服务器进行身份验证时发生错误”

我正在尝试通过创建 Firestore 文档(消息)时触发的 Firebase 云函数中的 FCM 向主题发送消息。订阅主题(也使用函数完成)并触发发送函数工作正常,但实际发送失败,并显示:

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/setup for setup instructions.
Run Code Online (Sandbox Code Playgroud)

以及一些包含<H1>PROJECT_NOT_PERMITTED</H1>和的原始 HTML <H1>PROJECT_NOT_PERMITTED</H1>

这是我的代码(index.ts):

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/setup for setup instructions.
Run Code Online (Sandbox Code Playgroud)

和(messages.ts):

import * as admin from …
Run Code Online (Sandbox Code Playgroud)

firebase typescript google-cloud-functions firebase-cloud-messaging firebase-admin

6
推荐指数
1
解决办法
2953
查看次数

Firebase setDoc() 不创建文档

我正在使用 auth 创建一个新用户,该用户正在工作,然后使用新创建的 uid 创建一个具有相同内容的新文档。

const currentUser = await auth.createUserWithEmailAndPassword(email, pass);
        console.log('user registered')
        await setDoc(doc(db, "users", currentUser.user.uid),{
            forname: "Peter",
            surname: "Parker"
        })
        console.log('user profile added')
    dispatch({type:'USER_REG', payload: currentUser});
Run Code Online (Sandbox Code Playgroud)

当我收到控制台日志时,reg 进程会毫无问题地启动,然后程序只是等待,就像 setDoc 正在运行但从未完成,我不知道为什么。任何帮助表示赞赏。

javascript firebase reactjs firebase-authentication google-cloud-firestore

5
推荐指数
1
解决办法
5975
查看次数