【发布时间】:2021-01-15 17:50:38
【问题描述】:
当用户在我的 IOS 应用上创建帐户时,我正在尝试创建条带客户。当我运行命令firebase deploy --only functions 时,我的所有功能都崩溃了。但是当我删除时
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);
});
});
我收到错误消息
函数加载用户代码失败。错误信息:错误:请检查您的函数日志以查看错误原因:https://cloud.google.com/functions/docs/monitoring/logging#viewing_logs
在浏览完我的代码后,我将其范围缩小到了这些行。当我删除三个 const 时,我收到同样的错误。如果我删除导出并保留 const,同样的事情。我的功能只有在我删除所有这些时才会推送。有什么我想念的吗?我见过类似的问题,这里的答案与我的代码相似,所以我很困惑。我正在检查我的日志,它不是描述性的,它只是重复相同的消息。
我在 firebase 函数中收到的日志消息是,
详细的堆栈跟踪:错误:找不到模块“@google-cloud/logging”
【问题讨论】:
-
这里的消息所指的函数日志中的错误是什么?请编辑问题并将这些消息复制到其中。
-
@DougStevenson 他们根本不是贬义词,它只是在终端中重复消息。
-
请继续编辑问题以显示此代码运行时生成的所有相关日志消息。
-
@DougStevenson 我已经更新了原来的问题
-
按照给定的链接学习如何检查日志没有帮助?
标签: javascript node.js firebase google-cloud-functions