云功能 - firestore:event.data.toJSON不是函数

时间:2018-01-27 09:55:33

标签: javascript firebase firebase-authentication google-cloud-functions

根据文档看起来event.data传递给auth.user()。onCreate  应该是UserRecord
https://firebase.google.com/docs/functions/auth-events#access_user_attributes
https://firebase.google.com/docs/reference/functions/functions.auth.UserRecord

但是在我的云功能中如果我event.data.toJSON()我得到了

  

TypeError:event.data.toJSON不是函数

我想将数据写入firestore。为了得到我必须做的数据

JSON.parse(JSON.stringify(event.data));

获取用户数据的普通对象表示的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

看起来像SDK中的一个错误。我向团队提出了一个问题。

IMO解决方法直到修复此问题为将值复制到普通JavaScript对象并使用它添加到Firestore。