angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

The Cloud Firestore API is not enabled for the project

Open SlimenTN opened this issue 9 years ago • 14 comments

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

SlimenTN avatar Oct 07 '17 10:10 SlimenTN

You must enable it from the firebase console

Toxicable avatar Oct 07 '17 10:10 Toxicable

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

SlimenTN avatar Oct 07 '17 10:10 SlimenTN

Ok I did it thank you.

SlimenTN avatar Oct 07 '17 11:10 SlimenTN

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"

fanals avatar Oct 25 '17 21:10 fanals

thank you so much!

PreciousDiaz avatar Feb 06 '18 03:02 PreciousDiaz

hi , are you solve to problem

ghost avatar Mar 09 '18 04:03 ghost

@MahmoodAhmaed98 yes, as @fanals said :

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

SlimenTN avatar Mar 09 '18 07:03 SlimenTN

Solution :

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

encode101 avatar Apr 17 '18 05:04 encode101

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

joseduno avatar Aug 26 '18 23:08 joseduno

Hi Guys!

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

Regards.

santiagoseverino avatar Mar 28 '19 21:03 santiagoseverino

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

JaimeCardenas176 avatar Jul 30 '19 21:07 JaimeCardenas176

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! 😃

tknappra avatar Aug 27 '19 21:08 tknappra

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 avatar Feb 29 '20 12:02 tewodroswondimu

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

binoyudayan avatar Mar 26 '20 12:03 binoyudayan