41

I am learning how to set up and host a webpage through firebase, and when I attempt to initialize the project (by running firebase init in the firebase CLI) every time I reach the firestore setup portion, it always results in the same error.

It looks like you haven't used Cloud Firestore in this project before. Go to https://console.firebase.google.com/project/resume-site-599bc/firestore to create your Cloud Firestore database

When I copy and paste the link, it brings me to the firebase console page and says "your action was forbidden" no matter what I do. I have tried to go into the console settings and made sure all of the correct APIs are enabled. But there seems to be little help when I tried googling the issue.

Thank you.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
ajmartire
  • 411
  • 1
  • 4
  • 3

8 Answers8

133

I had the very same and error and fixed it with @MS29's method. More verbose for simplicity:

  • In the Firebase Dashboard, go to Project Settings -> General
  • Set "Default GCP resource location" again.

After that, the Firestore can be found again.

lmaooooo
  • 3,364
  • 4
  • 19
  • 24
  • 11
    Worked like a charm! Why does not Firebase tell us this in the error message instead?? – Sunkas Nov 25 '22 at 10:07
  • 2
    This works. Why is this not an accepted answer? – Aayush Goyal Dec 29 '22 at 16:56
  • 5
    Not able to change default GCP location anymore. It shows it cannot be changed once set. – Nvv Dec 30 '22 at 14:35
  • 9
    @Nvv just push "Done" – DJ Burb Jan 01 '23 at 03:04
  • 2
    Thanks, that worked for me too. Just to put it out, the error message is really misleading, and being present for more than 2 years is infuriating. The CLI should've been fixed ages ago to detect this issue and if not auto fix, at least give a meaningful message with directions. – Leu Jan 04 '23 at 09:57
  • my location got wiped out after I renamed my project, i had to reopen the setting mentioned in this answer to get it to reassign. then it worked. I just wanted to let others know a possible reason for this problem – J King Jan 31 '23 at 17:10
  • 1
    Brilliant - can't believe it isn't in the error handling – deadant88 May 01 '23 at 01:58
  • Firebase has been around for this long and they still have huge gapping holes in their product that cost developers hours of list time. – Michael Nelles May 02 '23 at 17:12
31

So even though I already had the project created and I created my Firestore database, my: Default GCP resource location didn't select properly when creating the project. Once I fixed this, it had no problem connecting to my database.

MS29
  • 311
  • 2
  • 3
4

I've faced the same problem with Angular 14.2.0 and firebase 19.14. The solution for me was as follow:

I've checked the project list by using firebase cli: firebase projects:list

There I noticed that the Resource Location ID wasn't set for any reasons. So I opened the settings of my firebase-project using the console (https://console.firebase.google.com/) and on project settings tab u can set the GCP. That's it

1

Look like you haven't create project on your firebase account So firebase ask you go into the link to create project.

For the problem of "your action was forbidden", it seem to be the problem of multi google accounts. Google still work quite bad on multi accounts sometime. You can try access the google firebase console main page by the link below.

https://console.firebase.google.com/u/0/

https://console.firebase.google.com/u/1/

The last number is the number of user. You can change it if you have many google accounts.

P.S. The user order will change if you logout.

Mike Yan
  • 1,669
  • 2
  • 21
  • 27
0

Most likely that you don't have the project created in firebase. Either create a new project by going to

https://firebase.corp.google.com/u/0/

or enable Firebase for an existing GCP project by choosing that project in the add project page

Methkal Khalawi
  • 2,368
  • 1
  • 8
  • 13
0

it's happening same to me too, but in my case: I already created the database at Firestore Cloud *at their website

for now I'm still troubled with it, if I have solution.

#update

hello, I'm in bandwagon when it comes to this problem: [firebase init firestore not work with existing project] I'm using firebase CLI version 10.6.0

but somehow I manage to deal with it, here's my solution/timeline:

  1. I install using firebase login --no-localhost because encounter problems with firebase login
  2. encountered with errors: cannot install firestore but hosting part can.
  3. try to reset database, created again but still get error: cannot install firestore
  4. then I logout, then login using ONLY firebase login, not the firebase login --no-localhost
  5. bang! solved!

hope it helps~

ruhaifie
  • 1
  • 1
0

Please note that I am on Mac, it may not work for Windows (I have no idea).

Make sure your firebase-tools is the latest version; mine was stuck at 11.11.0.

If npm install firebase-tools or npm update firebase-tools doesn't work, do curl -sL https://firebase.tools | upgrade=true bash, as on the firebase documentation. Saw this solution here for how to update firebase (as I was hoping that that may be the issue).

I had already tried everything else, and my region was already set in project settings.

Good luck, whoever comes to this in the future.

0

In my project the Default GCP resource location was set but I was still getting the error. So I did this:

firebase init --debug This gave me a verbose output and I was able to deduce that a billing account wasn't linked to the project.

If that's the same for you, you should go to the GCP console's billing page to sort it out. GCP Billing page

sathishvj
  • 1,394
  • 2
  • 17
  • 28