简体   繁体   English

在创建 iOS 和 firebase 时创建条带客户时出错

[英]error creating stripe customer on create iOS and firebase

I am trying to create a stripe customer when the user creates an account on my IOS app.当用户在我的 IOS 应用程序上创建帐户时,我正在尝试创建条纹客户。 When I run the command firebase deploy --only functions All of my functions crash.当我运行命令firebase deploy --only functions ,我的所有功能都崩溃了。 but when I delete但是当我删除

const logging = require('@google-cloud/logging');
const stripe = require('stripe')(functions.config().stripe.token);
const currency = functions.config().stripe.currency || 'USD';



  exports.createStripeCustomer = functions.auth.user().onCreate((user) => {
  return stripe.customers.create({
  email: user.email,
  }).then((customer) => {
    return admin.database().ref(`/stripe_customers/${user.uid}/customer_id`).set(customer.id);
  });
});

I am receiving the error我收到错误

Function failed on loading user code.函数加载用户代码失败。 Error message: Error: please examine your function logs to see the error cause: https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs错误消息:错误:请检查您的函数日志以查看错误原因: https : //cloud.google.com/functions/docs/monitoring/logging#viewing_logs

After going through my code I have narrowed it done to these lines.在完成我的代码之后,我将它缩小到这些行。 When I delete the three const, I receive the same error.当我删除三个 const 时,我收到相同的错误。 If I delete the export and keep const, the same thing.如果我删除导出并保留常量,同样的事情。 My functions only push when I delete all of this.我的功能只有在我删除所有这些时才会推送。 Is there something I am missing?有什么我想念的吗? I have seen similar questions and the answers on here have resembled the code I have so I am confused.我见过类似的问题,这里的答案与我的代码相似,所以我很困惑。 I am checking my logs and it is not descriptive it is just repeating the same message.我正在检查我的日志,它不是描述性的,它只是重复相同的消息。

The log messages I am receiving in firebase functions is,我在 firebase 函数中收到的日志消息是,

Detailed stack trace: Error: Cannot find module '@google-cloud/logging'详细的堆栈跟踪:错误:找不到模块“@google-cloud/logging”

If you want to use a module, you have to install it first before you deploy.如果要使用模块,则必须在部署之前先安装它。 From your functions folder, where the original package.json exists:从原始 package.json 所在的函数文件夹中:

npm install @google-cloud/logging

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM