Firebase Connection Trouble

Sorry for the basic question, I am new to Firebase and just found ReTool. Sounds like exactly the tool I am looking for to build a quick admin interface for my data.

I have trouble with the most basic connection to my data store. I get this:
error:"7 PERMISSION_DENIED: Permission denied on resource project test-firebase.

I have gone thorough the video and docs several times on how to set up the resource. I tried Firebase projects in two separate accounts with simple test Firestore Databases.

I add Firebase Database URL, Firestore Project ID and Service Account Key
The ā€œtest connectionā€ check says success, but it seems to do that regardless of what I enter.

I am not clear how the URL to the ā€œRealtime Databaseā€ is relevant. I created one to get a URL but I have nothing in there (null). I only have a collection with a few documents in the ā€œFirestore Databaseā€. But thatā€™s me not understanding how they might be linked.

The ā€œfirebase-adminsdkā€ (Firebase Admin SDK Service Agent) is set up. I pulled the private key from the Firebase project setting, services account tab - and also went the GCP route via the service accounts section, new key as JSON.

I have been reading and trying things for hours, I have to admit I am stuck. I hope someone here can point me into the right direction to solve this. Thank you!

2 Likes

RESOLVED.

I wish Iā€™d understand what went wrong. Here is what fixed it: I deleted the Admin SDK services account in GCP and re-created a new service account via the Firestore admin tools. Took a few minutes to sync and disappear in Firestore before I could recreate it. Then everything worked.

3 Likes

Glad you were able to figure it out @M10 :slight_smile:

I wish they just put this in the documentation, 2 hours of screwing around and it works instantly as soon as I tried this solution

Does anyone have an update to fix this problem that doesn't involve destroying currently active resources? My current Admin SDK is used in various places so deleting and recreating isn't an easy fix.

Is this a google cloud issue?

This isn't resolved IMO

Hi @coop! Thanks for reaching out.

:thinking: It does seem likely that it is a Google cloud related issue/change. Could you possibly create a new one specifically for Retool use, rather than deleting + recreating?

Having the same problem just after creating a service account from firebase console.

Hi @nao! Thanks for reaching out. To confirm, you're getting a permission denied error for all Firebase queries?

Working with another person that hit this, just wanted to add their detail on how they got it to work in case it helps others in the future :grinning:

After standing up a new Firebase project and going through the service account and Retool resource setup, everything worked. The original project (created ~2020) still didn't connect, and the Firestore Rules were nearly identical to the fresh project except for missing the clause: rules_version = '2'; Adding that to my original then allowed Retool to work properly and insert documents to Firestore!

Firebase Database URL : https://project-id.firebaseapp.com/
Firestore Project ID: project-id
Service Account Key: exported from console->project settings->service accounts-> generate admin sdk key

The problem was I was using Firebase DB URL https://project-id.firebaseio.com/, firebaseio.com doesn't work firebaseapp.com does.

:innocent: docs need to be updated.

UPDATE!

It is now working with firebaseio.com too, i think it took sometime
like 4 hours, and after that it started working. Mysterious!

1 Like

Thanks for this update, @ahmadalibaloch! Strange :thinking: but hopefully helps others that may run into similar issues