質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Stripe

Stripeとは、米国のオンライン決済システム提供企業、及び同社が提供する決裁システムを指します。Webサイトやモバイルアプリにコードを組み込むことでクレジットカードなどの決済サービスが簡潔に追加できます。

Q&A

0回答

1093閲覧

Cloud Functionsのデプロイでエラーが発生し解決出来ない

ttah

総合スコア35

Firebase

Firebaseは、Googleが提供するBasSサービスの一つ。リアルタイム通知可能、並びにアクセス制御ができるオブジェクトデータベース機能を備えます。さらに認証機能、アプリケーションのログ解析機能などの利用も可能です。

Stripe

Stripeとは、米国のオンライン決済システム提供企業、及び同社が提供する決裁システムを指します。Webサイトやモバイルアプリにコードを組み込むことでクレジットカードなどの決済サービスが簡潔に追加できます。

0グッド

0クリップ

投稿2021/03/04 11:46

編集2021/03/04 11:48

決済にStripeを使いたいのですが
Functionsへデプロイ時にエラー発生して上手く行きません

webのfunctionsのコンソールのログは以下となっています(一部抜粋)

"@type":"type.googleapis.com/google.cloud.audit.AuditLog","status": {"code":3,"message":"Function failed on loading user code. This is likely due to a bug in the 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. Additional troubleshooting documentation can be found at https://cloud.google.com/functions/docs/troubleshooting#logging. Please visit https://cloud.google.com/functions/docs/troubleshooting for in-depth troubleshooting documentation."},"authenticationInfo":

Cloud Functions のトラブルシューティング

↑こちらのエラーメッセージ↓の解決策を読みましたが私のレベルでは何をどうすれば解決できるのか分かりませんでした

Cloud Logging のログ: 「Function to failed on user code.This is likely due to a bug in the user code.」

デプロイしたい関数
index.ts

index.ts

1import * as functions from 'firebase-functions'; 2 3const stripe = require('stripe')(functions.config().stripe.token); 4 5// MARK: - Create stripe customer and return customerId to your app 6exports.createStripeCustomer = functions.https.onCall(async (data, context) => { 7 const email = data.email; 8 const customer = await stripe.customers.create({email: email}); 9 const customerId = customer.id; 10 return { customerId: customerId } 11}); 12 13 14 15// MARK: - Create one time token for stripe 16exports.createStripeEphemeralKeys = functions.https.onCall((data, context) => { 17 const customerId = data.customerId; 18 const stripe_version = data.stripe_version; 19 return stripe.ephemeralKeys 20 .create({ 21 customer: customerId, 22 stripe_version: stripe_version 23 }) 24}); 25 26// MARK: - create Stripe charge 27exports.createStripeCharge = functions.https.onCall((data, context) => { 28 const customer = data.customerId; 29 const source = data.sourceId; 30 const amount = data.amount; 31 32 return stripe.charges.create({ 33 customer: customer, 34 source: source, 35 amount: amount, 36 currency: "jpy", 37 }) 38});

原因と解決方法が分かる方がおられたらご教授頂きたいです。
よろしくいお願いします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問