{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/1344","repository_url":"https://api.github.com/repos/firebase/firebase-js-sdk","labels_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/1344/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/1344/comments","events_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/1344/events","html_url":"https://github.com/firebase/firebase-js-sdk/issues/1344","id":375491247,"node_id":"MDU6SXNzdWUzNzU0OTEyNDc=","number":1344,"title":"Firebase throw error `Missing or Insufficient Permissions` after logout","user":{"login":"dashracer","id":2896774,"node_id":"MDQ6VXNlcjI4OTY3NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2896774?v=4","gravatar_id":"","url":"https://api.github.com/users/dashracer","html_url":"https://github.com/dashracer","followers_url":"https://api.github.com/users/dashracer/followers","following_url":"https://api.github.com/users/dashracer/following{/other_user}","gists_url":"https://api.github.com/users/dashracer/gists{/gist_id}","starred_url":"https://api.github.com/users/dashracer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dashracer/subscriptions","organizations_url":"https://api.github.com/users/dashracer/orgs","repos_url":"https://api.github.com/users/dashracer/repos","events_url":"https://api.github.com/users/dashracer/events{/privacy}","received_events_url":"https://api.github.com/users/dashracer/received_events","type":"User","site_admin":false},"labels":[{"id":710626490,"node_id":"MDU6TGFiZWw3MTA2MjY0OTA=","url":"https://api.github.com/repos/firebase/firebase-js-sdk/labels/Component-Firestore","name":"Component-Firestore","color":"e881d1","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-10-30T13:33:58Z","updated_at":"2018-10-30T21:35:10Z","closed_at":"2018-10-30T21:35:10Z","author_association":"NONE","body":"<!-- Step 1 [READ THIS] -->\r\n<!--\r\nAre you in the right place?\r\n  * For issues or feature requests related to __the code in this repository__\r\n    file a Github issue.\r\n    * If this is a __feature request__ make sure the issue title starts with \"FR:\".\r\n  * For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)\r\n    with the firebase tag.\r\n  * For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)\r\n    google group.\r\n  * For help troubleshooting your application that does not fall under one\r\n    of the above categories, reach out to the personalized\r\n    [Firebase support channel](https://firebase.google.com/support/).\r\n-->\r\n\r\n<!-- Step 2 -->\r\n\r\n### [REQUIRED] Describe your environment\r\n\r\n * Operating System version: MacOS\r\n  * React Native, Expo SDK 30 \r\n  * Firebase SDK version: 5.3.0\r\n  * Firebase Product: \r\n     ```\r\n           firebase@^5.3.0:\r\n           version \"5.5.6\"\r\n            resolved \"https://registry.yarnpkg.com/firebase/-/firebase-5.5.6.tgz#035f838b0e01b2a781c765fb119c0a5a9e3a1e86\"\r\n         dependencies:\r\n              \"@firebase/app\" \"0.3.4\"\r\n              \"@firebase/auth\" \"0.7.8\"\r\n              \"@firebase/database\" \"0.3.6\"\r\n              \"@firebase/firestore\" \"0.8.6\"\r\n              \"@firebase/functions\" \"0.3.1\"\r\n              \"@firebase/messaging\" \"0.3.6\"\r\n              \"@firebase/polyfill\" \"0.3.3\"\r\n              \"@firebase/storage\" \"0.2.3\"\r\n     ```\r\n\r\n<!-- Step 3 -->\r\n\r\n### [REQUIRED] Describe the problem\r\n\r\n#### Steps to reproduce:\r\n<!--\r\n  What happened? How can we make the problem occur?\r\n  This could be a description, log/console output, etc.\r\n-->\r\n\r\n- Sign in using firebase authentication\r\n- Try to query firestore data, there are rules on the firestore\r\n- Show the data on a screen\r\n- Logout on firebase\r\n- The app crashed with error `Missing or insufficient permissions`\r\n\r\n#### Relevant Code:\r\n\r\n<!--\r\n  Reproduce the issue on StackBlitz and provide your forked URL\r\n  or give us some sample code below\r\n-->\r\n\r\n\r\n```javascript\r\n// sample query user using firestore, rxjs and rxfire\r\nexport const getUser = (uid: string): Observable<{}> => {\r\n  const firestore = firebaseApp.firestore();\r\n  firestore.settings({ timestampsInSnapshots: true });\r\n\r\n  let usersCollection = firestore.collection(\"users\").where(\"uid\", \"==\", uid);\r\n\r\n  return combineLatest([collectionData(usersCollection)]).pipe(\r\n    map(([users]) => {\r\n      if (users.length > 0) {\r\n        return users[0];\r\n      }\r\n      return {};\r\n    })\r\n  );\r\n};\r\n```\r\n\r\n#### Error log\r\n```\r\nMissing or insufficient permissions.\r\n\r\nFirestoreError\r\n    index.cjs.js:346:32\r\nfromRpcStatus\r\n    index.cjs.js:5550:34\r\nfromWatchChange\r\n    index.cjs.js:6048:57\r\nonMessage\r\n    index.cjs.js:14233:58\r\n<unknown>\r\n    index.cjs.js:7698:19\r\ntryCallOne\r\n    core.js:37:14\r\n<unknown>\r\n    core.js:123:25\r\n_callTimer\r\n    JSTimers.js:152:6\r\n_callImmediatesPass\r\n    JSTimers.js:200:17\r\ncallImmediates\r\n    JSTimers.js:464:11\r\n__callImmediates\r\n    MessageQueue.js:327:4\r\n<unknown>\r\n    MessageQueue.js:145:6\r\n__guardSafe\r\n    MessageQueue.js:314:6\r\nflushedQueue\r\n    MessageQueue.js:144:17\r\n\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/comments/434478682","html_url":"https://github.com/firebase/firebase-js-sdk/issues/1344#issuecomment-434478682","issue_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/1344","id":434478682,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNDQ3ODY4Mg==","user":{"login":"dashracer","id":2896774,"node_id":"MDQ6VXNlcjI4OTY3NzQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2896774?v=4","gravatar_id":"","url":"https://api.github.com/users/dashracer","html_url":"https://github.com/dashracer","followers_url":"https://api.github.com/users/dashracer/followers","following_url":"https://api.github.com/users/dashracer/following{/other_user}","gists_url":"https://api.github.com/users/dashracer/gists{/gist_id}","starred_url":"https://api.github.com/users/dashracer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dashracer/subscriptions","organizations_url":"https://api.github.com/users/dashracer/orgs","repos_url":"https://api.github.com/users/dashracer/repos","events_url":"https://api.github.com/users/dashracer/events{/privacy}","received_events_url":"https://api.github.com/users/dashracer/received_events","type":"User","site_admin":false},"created_at":"2018-10-30T21:35:10Z","updated_at":"2018-10-30T21:35:10Z","author_association":"NONE","body":"Sorry, I've resolved this issue by unsubscribing all the rxjs observable on component will unmount.\r\n\r\n"}}
{"actor":{"display_login":"dashracer"}}