Angularfire: The Cloud Firestore API is not enabled for the project

Created on 7 Oct 2017  路  14Comments  路  Source: angular/angularfire

Version info

Angular: 4.2.4

Firebase: 4.5.0

AngularFire: 5.0.0-rc.2
In my AppComponent class I wanted to call couses list from the database like this:

import { Component } from '@angular/core';
import { AngularFireDatabase } from 'angularfire2/database';
import { AngularFirestore } from 'angularfire2/firestore';
import { Observable } from 'rxjs/Observable';

@Component({
  selector: 'app-root',
  template: `
  <ul>
    <li *ngFor="let item of items | async">
      {{ item.name }}
    </li>
  </ul>
  `,
})
export class AppComponent {
  title = 'Angular with Firebase';
  courses: any[];
  items: Observable<any[]>;

  constructor(store: AngularFirestore){
    this.items = store.collection('courses').valueChanges();
  }
}

But I get this error in the console:
ERROR Error: The Cloud Firestore API is not enabled for the project fir-demo-376da

Most helpful comment

To let others knows where it is in the firebase console:

Select your project then click on Database and change the dropdown from "Realtime Database" to "Cloud Firestore"

All 14 comments

You must enable it from the firebase console

And how can I do it please, this is my first project with angular and firebase

Ok I did it thank you.

To let others knows where it is in the firebase console:

Select your project then click on Database and change the dropdown from "Realtime Database" to "Cloud Firestore"

thank you so much!

hi , are you solve to problem

@MahmoodAhmaed98 yes, as @fanals said :

Select your project then click on Database and change the dropdown from "Realtime Database" to "Cloud Firestore"

Solution :

Login To Console.
Click on Database
There You Can Select Any of The Two FileStorage you want.

Thanks!, I had the same problem and could solve it!

Hi Guys!

I do i need to create the fields on the database?

Regards.

@santiagoseverino it's not needed, fields will be set exactly as you add registers to the database in your code

Maybe someone will run into the same problem I had, so I'll share it...

Scenario
I have an older firebase project that I'm currently updating to use firestore (previously used real-time database). I'm using the node.js admin SDK.

Problem
I enabled firestore in the firebase console. But, still got the error... I tried all kinds of stuff to try to fix the error (updated node, generated new admin SDK keys, added 'apps' in the firebase console (looks like a handy new feature of firebase 馃憤, but didn't help...), initialized the admin SDK in some alternative ways, etc) and nothing worked...

Solution
Finally, oddly enough, my solution was to manually add something to firestore from the firebase console. Then, everything was working fine...

Perhaps just the act of adding something to firestore from the firebase console of my old firebase project triggered something in the project's corresponding google cloud project that made firestore get activated.

Hope this saves someone a headache migrating old project code from real-time database to firestore! 馃槂

Had a similar issue and found that by enabling the api in google's app engine, I got it to work.

Original solution can be found here

@tewodroswondimu I was looking for this. Solved my issue.Thank you!

Was this page helpful?
0 / 5 - 0 ratings