Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Firebase云功能上搜索和更新文档_Firebase_Google Cloud Firestore_Firebase Authentication_Google Cloud Functions - Fatal编程技术网

在Firebase云功能上搜索和更新文档

在Firebase云功能上搜索和更新文档,firebase,google-cloud-firestore,firebase-authentication,google-cloud-functions,Firebase,Google Cloud Firestore,Firebase Authentication,Google Cloud Functions,我正在尝试将Stripe与Firebase集成为后端。 当新用户注册到我的应用程序时,我需要创建stripe customer。 为此,我编写了1个云函数,该函数将在Firebase Auth创建新用户时执行。 但在该函数中,我得到了Firebase auth的用户。 因此,我需要更新为该用户创建的收藏文档。(我正在收藏文档中存储身份验证用户的uid)。 但Firebase云函数并没有更新它。 这是我的云函数 // When a user is created, register them wi

我正在尝试将Stripe与Firebase集成为后端。
当新用户注册到我的应用程序时,我需要创建stripe customer。
为此,我编写了1个云函数,该函数将在Firebase Auth创建新用户时执行。 但在该函数中,我得到了Firebase auth的用户。
因此,我需要更新为该用户创建的收藏文档。(我正在收藏文档中存储身份验证用户的uid)。
但Firebase云函数并没有更新它。
这是我的云函数

// When a user is created, register them with Stripe
exports.createStripeCustomer = functions.auth.user().onCreate(async (user) => {
  const customer = await stripe.customers.create({email: user.email});
  return admin.firestore().collection('fl_users').doc(user.uid).set({customer_id: customer.id});
});

我不知道什么需要更新,怎么更新。您能帮我解决我的问题吗?

您在云功能控制台中看到任何错误吗?请注意,您需要参与“Blaze”定价计划。事实上,免费的“Spark”计划“只允许向谷歌拥有的服务发出出站网络请求”。@RenaudTarnec不,控制台上没有错误,是的,我在blaze plan上。你确定客户变量上有值吗?是的@安德烈斯米贾雷斯