gpt4 book ai didi

javascript - Firebase云函数返回错误错误: There is no user record corresponding to the provided identifier

转载 作者:太空宇宙 更新时间:2023-11-04 00:02:16 25 4
gpt4 key购买 nike

我想在触发器函数中设置CustomUserClaims,但随后出现此错误

enter image description here

这是我的代码:

   exports.onCreateCompaniesByUserFunction = 

functions.firestore.document('/companiesByUser/{userId}').onWrite((change, context) => {
const { userId } = context.params;

const document = change.after.exists ? change.after.data() : null;

console.log('document',document)
let owner = []
let employee = []
let editor = []

Object.keys(document).map(key => {
if (document[key] == 'affiliate' || document[key] == 'employee') {
employee.push( key )
} else if (document[key] == 'owner') {
owner.push( key )
} else if (document[key] == 'editor') {
editor.push( key )
}
});


console.log('owner',owner)
console.log('employee',employee)
console.log('editor',editor)
console.log('before the claims 2',userId)
return admin.auth().setCustomUserClaims(userId, {employee, owner, editor})
.then(() => {

console.log('claim set successfully!');
return true;



})
.catch((error) => {
console.log('in error',error);
});

});

根据日志中显示UserId存在,但提示没有用户对应。

最佳答案

尝试点击 Firebase 主屏幕右侧的“身份验证”。然后,单击“开始”。

启用您正在使用的所有登录方法。

这解决了我的问题。

关于javascript - Firebase云函数返回错误错误: There is no user record corresponding to the provided identifier,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54086080/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com