LoginSignup
4
2

「firebase deploy --only functions」が通らない時の対処法【Firebase】

Last updated at Posted at 2020-10-15

はじめまして、ますみです!

自己紹介.png

以下のようにfirebase deploy --only functionsを叩いたところ、エラーが発生した時の対処方法を紹介します。

% firebase deploy --only functions

=== Deploying to 'xxx'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...

Error: Cloud Runtime Config is currently experiencing issues, which is preventing your functions from being deployed. Please wait a few minutes and then try to deploy your functions again.
Run `firebase deploy --except functions` if you want to continue deploying the rest of your project.

対処法

エラーの内容としては、少し待てば解決しそうでしたが、一向に解決しなかったため、クライアント側のエラーだと考えました。色々と試行錯誤していくうちに、functions内のバージョンをaudit fixで調整したらデプロイに成功しました。

具体的には以下の手順で実行しました。

1. npm install

まず、改めてパッケージをインストールしてみました。

% npm install
audited 256 packages in 1.291s

32 packages are looking for funding
  run `npm fund` for details

found 4 high severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

2. npm audit fix

次に、audit fixを要求されたので、実行してみましょう。

% npm audit fix
up to date in 0.752s

32 packages are looking for funding
  run `npm fund` for details

fixed 0 of 4 vulnerabilities in 256 scanned packages
  1 package update for 4 vulnerabilities involved breaking changes
  (use `npm audit fix --force` to install breaking changes; or refer to `npm audit` for steps to fix these manually)

3. npm audit fix --force

強制的に実行しましょう。

% npm audit fix --force
npm WARN using --force I sure hope you know what you are doing.
+ firebase-admin@9.2.0
added 31 packages from 55 contributors, removed 53 packages, updated 25 packages and moved 2 packages in 8.038s

2 packages are looking for funding
  run `npm fund` for details

fixed 4 of 4 vulnerabilities in 256 scanned packages
  1 package update for 4 vulnerabilities involved breaking changes
  (installed due to `--force` option)

4. npm list --depth=0 && npm install

続いて、インストールされているパッケージのバージョンを確認しましょう。
また、改めてnpm installして、脆弱性がないかを確認しましょう。

% npm list --depth=0
functions@ /Users/xxx/Documents/xxx/functions
├── firebase-admin@9.2.0
├── firebase-functions@3.11.0
└── firebase-functions-test@0.2.2

% npm install
audited 234 packages in 1.074s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

5. cd .. && firebase deploy --only functions

最後に、デプロイしていきましょう。
functionsのディレクトリに入っているため、一つ上の階層に戻り(cd ..)、そこでデプロイを実行します。

% cd ..
% firebase deploy --only functions

=== Deploying to 'xxx'...

i  deploying functions
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔  functions: required API cloudbuild.googleapis.com is enabled
✔  functions: required API cloudfunctions.googleapis.com is enabled
i  functions: preparing functions directory for uploading...
i  functions: packaged functions (24.65 KB) for uploading
✔  functions: functions folder uploaded successfully
i  functions: creating Node.js 10 function helloWorld(us-central1)...
✔  functions[helloWorld(us-central1)]: Successful create operation.
Function URL (helloWorld): https://us-central1-xxx-xxx/helloWorld

✔  Deploy complete!

Project Console: https://console.firebase.google.com/project/xxx/overview

最後に

最後まで読んでくださり、ありがとうございました!
いかがだったでしょうか?

この記事を通して、少しでもあなたの学びに役立てば幸いです!

【仕事の相談はこちら】
お仕事の相談のある方は、下記のフォームよりお気軽にご相談ください。

問い合わせフォームはこちら

もしもメールでの問い合わせの方がよろしければ、下記のメールアドレスへご連絡ください。

info*galirage.com(*を@に変えてご送付ください)

🎁 「生成AI活用の無料相談券」もしくは「生成AIの社内ガイドライン(無料PDF)」を『公式LINE』で配布中 🎁
『生成AIを業務に活用したいけど、どうしたらいいかわからない』といった声を多くいただきます。

Galirageでは公式LINEにて、チャットやオンライン会議で「完全個別の生成AI活用無料相談会」を実施しております!
(期間限定で実施しているため、ご興味ある方はお早めに以下のLINE公式アカウントをご登録ください^^)
https://lin.ee/rvz6lMN

※ 予告なく、キャンペーンを終了する可能性がございますが、ご了承ください。

【業務内容】
具体的には、以下のお仕事を中心に受け付けております!(詳しくはこちら

  1. 受託開発(例:生成AIを使った社内システムの開発)
  2. コンサルティング(例:技術戦略のアドバイス)
  3. 講演(例:社内研修、イベント登壇)

※ 特に「生成AIを使ったシステム開発のご依頼」が多く、ご好評いただいております。

【これまでの相談事例】
以下のようなご相談が多くあります。

🔑 機密情報を漏洩させないための、生成AIのシステム構築をお願いしたい。
🤖 自社データを用いたFAQチャットボットの作り方を知りたい。
💡 ChatGPTを、自分たちの事業にどのように活かせるか、アドバイスやアイデアが欲しい。

おまけ

エンジニアの仲間(データサイエンティストも含む)を増やしたいため、公式LINEを始めました🎉

一緒に仕事をしてくれる方」「友だちとして仲良くしてくれる方」は、友だち追加をしていただけますと嬉しいです!(仲良くなった人たちを集めて、「ボードゲーム会」や「ハッカソン」や「もくもく会」もやりたいなと考えています😆)

とはいえ、みなさんにもメリットがないと申し訳ないので、特典を用意しました!

友だち追加後に、アンケートに回答してくれた方へ「エンジニア図鑑(職種20選)」のPDFをお送りします◎

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2