LoginSignup
4

More than 3 years have passed since last update.

Firebase Cloud Firestoreの導入時に発生したエラー:Error: 9 FAILED_PRECONDITION: The Cloud Firestore API is not enabled for the project

Posted at

Firebaseのコンソールにて、Firestoreのデータベースの作成で失敗

Firestoreのスタートガイドには以下のように記載されています。

  1. Firebase コンソールを開き、新しいプロジェクトを作成します。
  2. [データベース] セクションで [Firestore ベータ版を試してみる] をクリックします。
  3. [有効にする] をクリックします。

Cloud Firestore プロジェクトを作成すると、Cloud API Manager で API も有効になります。

しかし、3.の工程でインターネットの通信が途切れたりしてデータベースの作成に失敗すると、以下の画像の状態になってしまいます。
失敗した場合、「最読み込み」や「コレクションの追加」を行っても、Firestoreの操作を行うことができません。

また、Cloud FunctionsからFirestoreをアクセスを試みると下記のエラーが発生します。

Error: 9 FAILED_PRECONDITION: The Cloud Firestore API is not enabled for the project

スクリーンショット 2019-05-13 21.00.20.png

解決策

Firestoreを操作できない原因は、Google Cloud Platform上のCloud API ManagerのAPIが無効のままになっているためです。
そのため、Google Cloud Platformへアクセスして、以下の画像のようにFirestoreのAPIを有効にすれば、Firestoreを操作することができるようになります。

スクリーンショット 2019-05-14 20.04.56.png

4427C57E-C276-4D33-81A8-19212B451B3D.jpg

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