LoginSignup
13
4

More than 3 years have passed since last update.

【Firebase】deployがうまくいかない時の対処方法

Last updated at Posted at 2020-09-16

はじめに

本記事は初の投稿になります。わかりづらい点や間違ってる点がありましたら、コメントの程よろしくお願い致します。

  • 対象者
    • Firabaseの初心者向け
  • 大まかな流れ
    • Firebaseのデプロイコマンドである「firebase deploy」 を実施時のエラーの解決方法を記載する

目次

1. 背景
2. エラー内容
3. 解決概要
4. 解決方法
5. 参考記事

1. 背景

ReactとFirebaseの学習時で、「create-react-app」で作成したアプリをFirebaseにデプロイを実施。
※「firebase init」はfirestore / functions / hostingを選択

2. エラー内容

「firebase deploy」コマンドでデプロイを実施した時、以下のエラーがターミナルで発生

ターミナル
✔  functions: Finished running predeploy script.
i  firestore: reading indexes from firestore.indexes.json...
i  cloud.firestore: checking firestore.rules for compilation errors...
✔  cloud.firestore: rules file firestore.rules compiled successfully
i  functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i  functions: ensuring required API cloudbuild.googleapis.com is enabled...
⚠  functions: missing required API cloudbuild.googleapis.com. Enabling now...
✔  functions: required API cloudfunctions.googleapis.com is enabled

Error: HTTP Error: 400, Billing account for project 'xxxxxxxxxxxx' is not found. Billing must be enabled for activation of service(s) 'cloudbuild.googleapis.com,containerregistry.googleapis.com' to proceed.

3. 解決概要

Cloud FunctionsのNode.js対応バージョンは10 or 12(Blaze従量課金生)
そのため、現時点の解決方法はNode.jsのバージョンを下げる必要がある。
しかし、今後は使用できなくなる為、暫定的な対応になる。

公式引用

Node.js 8(2020 年 6 月 8 日に非推奨) Node.js 8 関数は、2020 年 2 月 15 日以降はデプロイできなくなります。すでにデプロイされている Node.js 8 関数は、2021 年 3 月 15 日をもって実行できなくなります。Node.js 8 ランタイムに関数をデプロイしている場合は、Node.js 10 ランタイムにアップグレードすることをおすすめします。

4. 解決方法

functions/package.jsonを修正する。

functions/package.json
  "engines": {
    "node": "8"
  }

5. 参考記事

Firebase 公式ドキュメント
stack overflow

13
4
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
13
4