Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8691

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

$
0
0

はじめに

以下のように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

Viewing all articles
Browse latest Browse all 8691

Trending Articles