question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot handle error from useFirestoreCollectionData

See original GitHub issue

Version info

React: 18.2.0

Firebase: 9.9.0

ReactFire: 4.2.2

Other (e.g. Node, browser, operating system) (if applicable): Next.js 12.2.2

Test case

use useFirestoreCollectionData and handle FirebaseError: Missing or insufficient permissions.

Steps to reproduce

  • Set permissions in firebase console and set a rule that doesn’t allow the query for a user
  • Make the query
const { status, data: users, error } = useFirestoreCollectionData(usersQuery);

Expected behavior

The hook doesn’t throw and the error is in error variable

Actual behavior

The hook throws and error cannot be handled without try catch (that should’t be used?) https://github.com/FirebaseExtended/reactfire/blob/9754f8690389feaa1a7a65348aab1567857bca72/src/useObservable.ts#L120-L134

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
aadito123commented, Sep 13, 2022

tagging @jhuleatt to hopefully increase visibility

0reactions
beamercolacommented, Dec 20, 2022

same

Read more comments on GitHub >

github_iconTop Results From Across the Web

Missing permissions error message right after login
I will have to find a way to handle auto signOut if not loggedIn while on a secured page. But from what I...
Read more >
Handle errors for Cloud Storage on Web - Firebase
Handle Error Messages ; storage/cannot-slice-blob, Commonly occurs when the local file has changed (deleted, saved again, etc.). Try uploading again after ...
Read more >
Handle Firestore watch listener errors | Google Cloud
listenErrors demonstrates how to handle listening errors. func listenErrors(ctx context.Context, w io.Writer, projectID, collection string) error {
Read more >
Error handling | Open Spherical Camera API
"code": "serverError", "message": "cannot get camera info." }
Read more >
Handle errors for Cloud Storage on Fluttter - FlutterFire
When in doubt, catch the exception thrown by the function and see what the error message has to say. final storageRef = FirebaseStorage.instance....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found