Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android firebase云函数中的删除路径及其递归子路径_Android_Firebase_Kotlin_Google Cloud Firestore_Google Cloud Functions - Fatal编程技术网

Android firebase云函数中的删除路径及其递归子路径

Android firebase云函数中的删除路径及其递归子路径,android,firebase,kotlin,google-cloud-firestore,google-cloud-functions,Android,Firebase,Kotlin,Google Cloud Firestore,Google Cloud Functions,我想从firestore中删除文档和文档中的所有集合。为此,我将使用节点8作为引擎的云函数,并实际部署了它。但有些事情并没有如预期的那样起作用 这是我的路线 /postsCollection/user/user\u posts\u collection/large documents 因此,我想删除用户文档以及该文档中包含的所有内容=>用户发布集及其文档 Node.js,云函数 exports.deleteUserPostsDocument = functions .runWith({

我想从firestore中删除文档和文档中的所有集合。为此,我将使用节点8作为引擎的云函数,并实际部署了它。但有些事情并没有如预期的那样起作用

这是我的路线 /postsCollection/user/user\u posts\u collection/large documents

因此,我想删除用户文档以及该文档中包含的所有内容=>用户发布集及其文档

Node.js,云函数

exports.deleteUserPostsDocument = functions
    .runWith({
        timeoutSeconds: 540,
        memory: '2GB'
    })
    .https.onCall(async(data, context) => {

        const path = data.path;

        await firebase_tools.firestore
            .delete(path, {
                project: process.env.GCLOUD_PROJECT,
                recursive: true,
                yes: true,
                token: functions.config().fb.token
            });

        return {
            path: path
        };
    });
Kotlin,调用函数

val path = "/posts/user"
val data = hashMapOf("path" to path)

var success = false

functions
    .getHttpsCallable("deleteUserPostsDocument")
    .call(data)
    .continueWith {task ->
        success = task.isSuccessful
    }.await()

return success
代码与它们显示的完全相同,如果您只是管理员,我只是删除了要访问的代码。所以这不应该有任何问题

我遵循了所有步骤,使用firebase登录、firebase登录:cli等。。我可以看到该函数被部署到我的firebase云函数中

问题:我错过了什么

编辑1:这里有一个屏幕截图,它正在调用云函数,但没有删除任何内容。

我决定看看这个,并注意到一些事情:

我有所有的软件包,除了firebase工具,这很奇怪,因为我在命令行中写了70次npm安装-g firebase工具,如文档所示。因此我决定自己添加它,因此现在package.json包含firebase工具依赖项

"firebase-admin": "^9.1.1",
"firebase-functions": "^3.11.0",
"firebase-tools": "^8.9.0"
然后我在index.js中重写了firebase_工具的要求:

const firebase\u tools=require('firebase-tools')

以防万一,我设置了通过执行命令行获得的令牌:firebase login:ci

在此处设置
firebase功能:配置:Set fb.token=“Set\u token\u here”

现在执行下一个命令行:firebase deploy——仅更新函数


最后有效:)

注意env.GCLOUD\u项目已被弃用,请改用env.GCP\u项目。