2
votes

I set up a new database in my Google Firebase account. The Rules for the database in my Google Firebase portal look like this:

Your security rules are defined as public, so anyone can steal, modify, or delete data in your database

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write;
    }
  }
}

However, when I attempt to connect from my Angular 6 app I'm getting the following error in my Console:

@firebase/database: FIREBASE WARNING: set at /Users failed: permission_denied Unhandled Promise rejection: PERMISSION_DENIED: Permission denied

Any idea what the issue might be? When I googled the error message, it seems like all the suggested resolutions said to configure the database security rules as shown in my code above.

2

2 Answers

1
votes

You didn't add the code where you set the data but I believe you used firebase instead of firestore.

That's why your permissions, even if set on firestore, do not avoid this error, because @firebase/database is for firebase realtime database, not firestore.

Use the angular firestore service instead.

1
votes

I was also facing the same issue while accessing the firebase database, even after allowing the read and write permission. In my case, I was updating the setting on "Cloud Firestore" - look at the console part where "Database" is shown. It should be "Realtime Database", you can also verify the database type from your environment.ts file where you have "databaseURL" key.

Make sure you are updating below the settings on a database which you are pointing in your environment.ts file.

{
/* Visit https://firebase.google.com/docs/database/security to learn more about     security rules. */

"rules": {
".read": true,
".write": true
  }
}