React-redux-firebase: Error with profile listener: Missing or insufficient permissions. Error: Missing or insufficient permissions.

Created on 18 Jul 2018  路  17Comments  路  Source: prescottprue/react-redux-firebase

When i logout from firebase, i got below errors

Error with profile listener: Missing or insufficient permissions. Error: Missing or insufficient permissions.
at new FirestoreError (index.cjs.js:346)
at JsonProtoSerializer../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromRpcStatus (index.cjs.js:5258)
at JsonProtoSerializer../node_modules/@firebase/firestore/dist/index.cjs.js.JsonProtoSerializer.fromWatchChange (index.cjs.js:5756)
at PersistentListenStream../node_modules/@firebase/firestore/dist/index.cjs.js.PersistentListenStream.onMessage (index.cjs.js:13652)
at index.cjs.js:13597
at PersistentListenStream. (index.cjs.js:13573)
at step (tslib.es6.js:91)
at Object.next (tslib.es6.js:72)
at tslib.es6.js:65
at new Promise ()
at Object.__awaiter (tslib.es6.js:61)
at index.cjs.js:13569
at index.cjs.js:13045

Most helpful comment

calling Firebase.logout() after firebase.auth().signOut() fixed the problem for me :

All 17 comments

Hi @wallacepeng ! I'm receiving the same error. Did you find a solution for this?

@lhas2 This is caused by using user profile for login with redirection handling enabled. You can workaround it by setting UserProfile to null in the config.
like

const rrfConfig = {
userProfile: null,
...
...
};

I have not tried setting enableRedirectHandling: false when userProfile is enabled. YOu may have a try too.

Duplicate of #494. Error logs are just warnings (though they use console.error) and can be ignored as they don't impact functionality. Going to look into a fix this weekend.

thanks.

I am still getting the same exact error, and it can't be ignored as any reload prevents the app from reading information from firestore, any workaround yet ? thanks !

@MoSwilam What version are you using? Have you tried the logErrors: false config option?

I am also receiving the same error
It is super annoying
@prescottprue how do I set the logErrors please

@debaosuidecl logErrors: false should be passed as part of your config into the store enhancer ( reactReduxFirebase) when creating your store:

const createStoreWithFirebase = compose(
  reactReduxFirebase(firebase, rrfConfig), // firebase instance as first argument
  // reduxFirestore(firebase) // <- needed if using firestore
)(createStore)

@MoSwilam have you tried this? We may want to open a new issue with repro steps and versions

I made it working without that error, with updating Firebase database rules section to:

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth.uid != null;
    }
  }
}

calling Firebase.logout() after firebase.auth().signOut() fixed the problem for me :

calling Firebase.logout() after firebase.auth().signOut() fixed the problem for me :

me too, thanks!

@411c0d3d

calling Firebase.logout() after firebase.auth().signOut() fixed the problem for me :

Thanks it also did the trick here. However, I wonder why this works. The type defs of my firebase module (5.8.6) does not include the logout() method, and neither does the official documentation.

I still believe that it is a bug, that you have to call an undocumented function in order to avoid errors.

What also makes me wonder, is that I can't catch the permission error returned when I sign out.

Here's how my code looks. I belive that handleFacebookLogout should catch the permission error but it doesn't.

  handleFacebookLogout = async () => {
    try {
      await firebase.auth().signOut()
       // firebase.logout() 
    } catch (e) {
      console.log('SIGNOUT ERROR', e)
    }
  }

  render() {
    return (
      <View style={styles.container}>
        <Text>UserProfileScreen</Text>
        <LoginButton onLogoutFinished={this.handleFacebookLogout} />
      </View>
    )
  }

There should for sure be improved documentation as well as improved typings that include this.

Also, the logout method itself should handle calling firebase.auth().signOut() internally, so I'm thinking there is still something wrong here, so going to reopen.

firebase.logout() thats all you need...

This is still an issue.

Fix released in v3.1.0 - thanks to @illuminist for the PR!

The tip or takeout for me was that you not should make a redirect on your signOut function.
Seems to work just fine without it! :rocket:

Was this page helpful?
0 / 5 - 0 ratings