代码之家  ›  专栏  ›  技术社区  ›  Darren

Firebase functions.auth.UserRecord不是函数

  •  1
  • Darren  · 技术社区  · 7 年前

    我正试图触发一场战争 火基 作用于 emailVerified 这是真的 auth.UserRecord TypeError: functions.auth.UserRecord is not a function 部署到时出错 .

    电子邮件验证 ?

    onCreate 用户,但功能是创建客户在条纹,我希望这只发生在电子邮件验证。

    exports = module.exports = functions.auth
    .UserRecord((uid, emailVerified) => {
      // isVerified
      if (emailVerified) {
        const cid = admin
          .database()
          .ref()
          .push().key;
    
        var customerObject = {
          id: cid,
          dateCreated: new Date(),
          dateModified: new Date()
        };
    
        return admin
          .firestore()
          .doc(`users/${uid}/billing/${cid}`)
          .set(customerObject);
      } else {
        // isNotVerified
        return null;
      }
    });
    
    1 回复  |  直到 7 年前
        1
  •  3
  •   Frank van Puffelen    7 年前

    存在的云函数的唯一Firebase身份验证触发器是 functions.auth.user().onCreate((user) functions.auth.user().onDelete((user) . 没有用于电子邮件验证的云功能触发器。

    另见:

    推荐文章