firebasegoogle-cloud-firestoregoogle-cloud-storagefirebase-security

In firebase rules how to check in firestore that a record exists in cloudstorage


I have records in firestore that refer to the names of files I have stored in cloudstorage. Before I allow a record to be written, I need to first check that the file has been uploadedto cloudstorage.

I realize that the files could later be removed, but at the time of writing the record I need to check that they have been uploaded so as to limit errors.

I only need to check for one file per one request. I tried using exists and refer to my bucket but I couldn't get it to work.


Solution

  • You cannot access data from Firebase Storage in security rules of Firestore. You can try either of these: