Skip to content

Compat + Firestore Insufficient Permissions #3163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
gragundier opened this issue Feb 17, 2022 · 5 comments
Closed

Compat + Firestore Insufficient Permissions #3163

gragundier opened this issue Feb 17, 2022 · 5 comments

Comments

@gragundier
Copy link

gragundier commented Feb 17, 2022

Version info

Angular: 13.2.3

Firebase: 9.6.6

AngularFire: 7.2.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):
Arch Linux
Firefox
[email protected]

How to reproduce these conditions

Steps to set up and reproduce

start a new app

ng new newapp
ng add @angular/fire
ng add @angular/material

etc.

create a component like so

import { Component, OnInit } from '@angular/core';
import { AngularFirestore } from '@angular/fire/compat/firestore';
import { Observable } from 'rxjs';

interface Item {
  name: string,
};

@Component({
  selector: 'app-blog',
  templateUrl: './blog.component.html',
  styleUrls: ['./blog.component.sass']
})
export class BlogComponent implements OnInit {

  item$: Observable<Item[]>;
  
  constructor(firestore: AngularFirestore) {
    this.item$ = firestore.collection('items').valueChanges() as Observable<Item[]>;
  }

  ngOnInit(): void {
  }

}

with html like so

<ul>
    <li *ngFor="let item of item$ | async">
      {{ item.name }}
    </li>
</ul>

rules set to

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

(I know that's a very very bad setup but it's only for my emulator and I'm desperate)

ng build --aot --watch
firebase emulators:start

Sample data and security rules
collection: items
items with document w/ name: hi

Debug output

Errors in the JavaScript console
FirebaseError: Missing or insufficient permissions.

Output from firebase.database().enableLogging(true);
n/a

Screenshots
n/a

Expected behavior

Requests found in emulator webpage. "Hi" on the webpage.

I am having trouble accessing the firestore database from my angular app very reminiscent of this issue. I've tried creating an entirely new project and am getting same error with both compatibility and modular versions. I opened the firestore emulator and no requests are being made. I've been trying to debug this issue on my own for a couple of weeks now and am now fairly certain this is a bug of some sort.

Blank webpage and a thrown error in JS console saying FIrebase Error: Insufficient Permissions

@google-oss-bot
Copy link

This issue does not seem to follow the issue template. Make sure you provide all the required information.

@juane1000
Copy link

I am having this exact same issue

@tamilselvanmariappan
Copy link

@gragundier same issue here. Did you find solution for it?

@davidbestel
Copy link

image

Remove app check.

@gragundier
Copy link
Author

image

Remove app check.

Moved on from the side-project that generated this, but I would say that removing App Check seems like a bad idea. Turning off a security feature isn't advised imo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants