首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >Google函数/google库:无法读取未定义的属性“用户”

Google函数/google库:无法读取未定义的属性“用户”
EN

Stack Overflow用户
提问于 2019-09-06 16:32:04
回答 1查看 545关注 0票数 0

以下内容:https://medium.com/@nedavniat/how-to-perform-and-schedule-firestore-backups-with-google-cloud-platform-and-nodejs-be44bbcd64ae

守则是:

代码语言:javascript
代码运行次数:0
运行
复制
const functions = require('firebase-functions'); // is installed automatically when you init the project
const { auth } = require('google-auth-library'); // is used to authenticate your request

async function exportDB () {
    const admin = await auth.getClient({
        scopes: [                               // scopes required to make a request
            'https://www.googleapis.com/auth/datastore',
            'https://www.googleapis.com/auth/cloud-platform'
        ]
    });
    const projectId = await auth.getProjectId();
    const url = `https://firestore.googleapis.com/v1beta1/projects/${projectId}/databases/(default):exportDocuments`;
    return admin.request({
        url,
        method: 'post',
        data: {
            outputUriPrefix: 'gs://name-of-the-bucket-you-created-for-backups'
        }
    });
}

const = functions.pubsub.topic('YOUR_TOPIC_NAME_HERE').onPublish(exportDB);module.exports ={ backup };

当我通过以下方式部署时:

代码语言:javascript
代码运行次数:0
运行
复制
gcloud functions deploy backup --runtime nodejs8 --trigger-topic YOUR_TOPIC_NAME_HERE

我得到了错误:

错误:(gcloud.functions.deploy) OperationError: code=3,message=Function在加载用户代码时失败。错误信息:无法加载文件index.js中的代码。代码中有语法错误吗? 详细堆栈跟踪: TypeError:无法读取未定义属性的“用户”

这是谷歌图书馆的东西吗?

EN

回答 1

Stack Overflow用户

发布于 2019-09-06 20:36:00

我假设您正在尝试部署由HTTP请求触发的GCF功能,我建议您检查这个link1似乎是相同的用例,并且可以帮助您在GCF上使用和node.js

1

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57825693

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档