Skip to content
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

error SignedOutException, for a firestore document that does not require authentication. #113

Open
Justus-M opened this issue Jul 15, 2023 · 4 comments

Comments

@Justus-M
Copy link

Justus-M commented Jul 15, 2023

Firstly huge thanks for this library.

I get the following error when trying to access a firestore document while the user is not authenticated.

It happens for both streaming and just getting the document.

Handling error gRPC Error (code: 13, codeName: INTERNAL, message: Error making call: SignedOutException: Attempted to call a protected resource while signed out, details: null, rawResponse: null, trailers: null) using FirestoreGateway._handleError

But here is the relevant firestore rule:

    match /config/{doc} {
      allow read: if true;
    }

Here is the full stacktrace


#134    Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#135    StatelessElement.update (package:flutter/src/widgets/framework.dart:5162:5)
#136    Element.updateChild (package:flutter/src/widgets/framework.dart:3686:15)
#137    SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6442:14)
#138    Element.updateChild (package:flutter/src/widgets/framework.dart:3686:15)
#139    RenderObjectToWidgetElement._rebuild (package:flutter/src/widgets/binding.dart:1240:16)
#140    RenderObjectToWidgetElement.update (package:flutter/src/widgets/binding.dart:1217:5)
#141    RenderObjectToWidgetElement.performRebuild (package:flutter/src/widgets/binding.dart:1231:7)
#142    Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#143    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2780:19)
#144    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:903:21)
#145    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:358:5)
#146    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1284:15)
#147    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1214:9)
#148    LiveTestWidgetsFlutterBinding.handleDrawFrame (package:flutter_test/src/binding.dart:1758:13)
#149    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1072:5)
#153    _invoke (dart:ui/hooks.dart:144:10)
#154    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:359:5)
#155    _drawFrame (dart:ui/hooks.dart:112:31)
(elided 59 frames from dart:async and package:stack_trace)

It looks like you are just blocking all unauthenticated requests, which is not always wanted.

If a dev doesn't want to allow access without authentication, they can set that up in the Firestore rules. I think rather than blocking all unauthenticated requests, it would be better to just leave that to the firestore rules.

@cachapa
Copy link
Owner

cachapa commented Jul 16, 2023

Thanks for the report.
On the surface this seems to be a bug, but I'm not currently equipped to test and debug it.

Contributions are welcome though, if you want to take this challenge yourself :-)

@Justus-M
Copy link
Author

Hi! I did actually see if I could fix it initially but ended up just going for a workaround yesterday.

I wanted to stream the app version number before the user logs in so I can force them to update if necessary (that's what I was doing with flutterfire). I now host a Json file instead, and periodically make an http request to read it.

I just had another look inside the firedart library but couldn't really wrap my head around where this error came from. When you do figure it out, I'll be very curious to understand the fix!

@vasuravada
Copy link

We got the same issue, Please help us with the quick fix.

@Justus-M
Copy link
Author

Justus-M commented Aug 3, 2023

We got the same issue, Please help us with the quick fix.

My workaround was actually not to use firestore. I only needed to stream one value before authentication, so I've put that value in a json file on the web and im reading it in a loop via Http requests.

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

3 participants