1

I have setup a small vm on google cloud compute. I want it to be able to access my firestore database, but I cannot make it work. I tried using the firebase-admin lib in the vm, but it is making a permission denied error. My firestore rules fine. Do you know how to do?

Thanks!

2 Answers2

2

I created this community wiki from the comment of the OP, as mentioned the solution was found on the next post.

It was required enable Cloud API access scope for the services on Google Cloud Console for VM instance details

It's required to stop the instance in order to change API scope as mentioned in the documentation

Emmanuel
  • 1,436
  • 1
  • 11
  • 17
0

You need to add Cloud Datastore User IAM role to the service account used by the instance, and set Cloud Datastore access scope to Enabled on that instance.

If your Firestore is hosted on a different GCP project than the one on which your Compute Instance is running, you will also need to add that service account to your Firestore's GCP project through IAM, and then give it that same role there.

Voy
  • 5,286
  • 1
  • 49
  • 59