流删除了Firebase函数中的错误

我有一个在创建新用户时运行的函数。在没有被调用一段时间后,该函数通常在第一次调用时失败。我希望有人能够帮助我找出可能导致这种情况的原因。流删除了Firebase函数中的错误

export const onUserCreate = functions.auth.user().onCreate(event => { 

const user: User = {

userId: event.data.uid,

email: event.data.email

};

return db.doc(`users/${user.userId}`).set(data);

});

回答:

,因为我用同样喜欢的下方,它工作得很好:

exports.onUserCreate = functions.auth.user().onCreate(event => { 

const user = event.data

console.log(user);

})

回答:

这似乎是现在火力地堡功能的错误,正在looked into。

编辑:

Hello all, Sebastian from the Firestore SDK team here. We believe this issue is related to the recent update of the GRPC Client SDK and have been running tests with GRPC 1.7.1. So far, we have not been able to reproduce this issue with this older GRPC version.

@google-cloud/firestore is now at 0.10.1. If you update your dependencies, you will be able to pull in this release.

Thanks for your patience.

Sebastian

回答:

这很难说是一个永久的答案,因为这是谷歌的东西似乎寻找到。

与此同时,尽管我对Google库中的类似错误消息进行了一些研究,但它看起来像是在函数外(即文件顶部)初始化Google库时偶尔会发生。

我已经添加了函数内该行执行的,而不是在全球范围内,它看起来已经停止错误:

const datastore = require('@google-cloud/datastore')({});

例如,而不是:

const datastore = require('@google-cloud/datastore')({}); 

module.exports.myFunction = function() {

datastore.get(key).then()....

}

你做

module.exports.myFunction = function() { 

const datastore = require('@google-cloud/datastore')({});

datastore.get(key).then()....

}

那会去也适用于Firebase库 - 不仅仅是数据存储。这不是最佳做法,应该在错误得到修复时将其改回。

回答:

我有同样的问题。原来,这是Firestore节点模块中的一个错误。更新@ google-cloud/firestore到版本0.10.1,它应该解决这个问题。

以上是 流删除了Firebase函数中的错误 的全部内容, 来源链接: utcz.com/qa/264311.html

回到顶部