[ToS] App crashes when ToS are missing from db
See original GitHub issueTo Reproduce
- Delete the
config/tos
document from a working Ground Firebase project. - Wipe app data on device and sign back in.
Expected behavior The project list appears.
Actual behavior An exception is thrown:
2021-11-09 18:25:05.731 8390-8390/com.google.android.gnd E/MainViewModel: Error loading terms of service from remote db
com.google.firebase.firestore.FirebaseFirestoreException: PERMISSION_DENIED: Missing or insufficient permissions.
at com.google.firebase.firestore.util.Util.exceptionFromStatus(Util.java:117)
at com.google.firebase.firestore.core.EventManager.onError(EventManager.java:166)
at com.google.firebase.firestore.core.SyncEngine.removeAndCleanupTarget(SyncEngine.java:588)
at com.google.firebase.firestore.core.SyncEngine.handleRejectedListen(SyncEngine.java:424)
at com.google.firebase.firestore.core.MemoryComponentProvider$RemoteStoreCallback.handleRejectedListen(MemoryComponentProvider.java:99)
at com.google.firebase.firestore.remote.RemoteStore.processTargetError(RemoteStore.java:562)
at com.google.firebase.firestore.remote.RemoteStore.handleWatchChange(RemoteStore.java:446)
at com.google.firebase.firestore.remote.RemoteStore.access$100(RemoteStore.java:53)
at com.google.firebase.firestore.remote.RemoteStore$1.onWatchChange(RemoteStore.java:176)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:108)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:38)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.lambda$onNext$1$AbstractStream$StreamObserver(AbstractStream.java:119)
at com.google.firebase.firestore.remote.-$$Lambda$AbstractStream$StreamObserver$IZBnAkL3D_hQ5ofbDpSmX2lhuPo.run(Unknown Source:4)
at com.google.firebase.firestore.remote.AbstractStream$CloseGuardedRunner.run(AbstractStream.java:67)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.onNext(AbstractStream.java:110)
at com.google.firebase.firestore.remote.FirestoreChannel$1.onMessage(FirestoreChannel.java:125)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:658)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:643)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:229)
at java.lang.Thread.run(Thread.java:764)
Caused by: io.grpc.StatusException: PERMISSION_DENIED: Missing or insufficient permissions.
at io.grpc.Status.asException(Status.java:541)
at com.google.firebase.firestore.util.Util.exceptionFromStatus(Util.java:115)
at com.google.firebase.firestore.core.EventManager.onError(EventManager.java:166)
at com.google.firebase.firestore.core.SyncEngine.removeAndCleanupTarget(SyncEngine.java:588)
at com.google.firebase.firestore.core.SyncEngine.handleRejectedListen(SyncEngine.java:424)
at com.google.firebase.firestore.core.MemoryComponentProvider$RemoteStoreCallback.handleRejectedListen(MemoryComponentProvider.java:99)
at com.google.firebase.firestore.remote.RemoteStore.processTargetError(RemoteStore.java:562)
at com.google.firebase.firestore.remote.RemoteStore.handleWatchChange(RemoteStore.java:446)
at com.google.firebase.firestore.remote.RemoteStore.access$100(RemoteStore.java:53)
at com.google.firebase.firestore.remote.RemoteStore$1.onWatchChange(RemoteStore.java:176)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:108)
at com.google.firebase.firestore.remote.WatchStream.onNext(WatchStream.java:38)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.lambda$onNext$1$AbstractStream$StreamObserver(AbstractStream.java:119)
at com.google.firebase.firestore.remote.-$$Lambda$AbstractStream$StreamObserver$IZBnAkL3D_hQ5ofbDpSmX2lhuPo.run(Unknown Source:4)
at com.google.firebase.firestore.remote.AbstractStream$CloseGuardedRunner.run(AbstractStream.java:67)
at com.google.firebase.firestore.remote.AbstractStream$StreamObserver.onNext(AbstractStream.java:110)
at com.google.firebase.firestore.remote.FirestoreChannel$1.onMessage(FirestoreChannel.java:125)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:658)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:643)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at com.google.firebase.firestore.util.AsyncQueue$SynchronizedShutdownAwareExecutor$DelayedStartFactory.run(AsyncQueue.java:229)
at java.lang.Thread.run(Thread.java:764)
Subsequent logins result in a white screen with no errors logged.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
TOS iOS app crashes : r/thinkorswim - Reddit
The TOS apps on my iPhone and iPad won't open anymore. They immediately crash. Does anyone else have this experience? I'm running the...
Read more >Android app crashes when made some changes in database
I have developed an android app which consists of database.When i install it on mobile it works fine for first time. when i...
Read more >Technical - thinkorswim Learning Center
My thinkorswim® platform is constantly 'reconnecting. ' What can I do? If you are connected wirelessly, you can start troubleshooting by shutting the...
Read more >Detect and diagnose crashes - Android Developers
Once you have identified that your app is reporting crashes, the next step is to diagnose them. Solving crashes can be difficult. However,...
Read more >App crashes after using useQuery or Realm.objects()
When I perform a query to list the data that are in the database through the useQuery(MyModel) command, the data is apparently loaded...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @shobhitagarwal1612, it looks this is related to #1026 and possibly a pre-existing error:
config/tos
is optional, and the DataStore methods that retrieve it return aMaybe
. I don’t understand why an error is returned if the document is missing rather thanMaybe.empty()
; maybe empty is returned only when the collection exists but the document is missing, but an error is returned when the collection doesn’t exist? Might be worth looking into.FirebaseFirestoreException.CODE UNAVAILABLE
isn’t specific to THE config, but the error message seems to imply it isCould you PTAL?
@atalekar Thanks! A few answers:
The ToS is optional, so if the ToS isn’t present the app should proceed to the project list after sign-in; not all deployments require a custom ToS.
A network connection is required for the sign-in and join project flows. The ToS is part of the sign-in flow, so it’s assumed the device is online. If it’s not, the sign-in flow should fail and return the user to the sign-in screen.
@rachaprince The ToS shouldn’t be required; our other pilot projects own their own Firebase instance, and as such have already agreed to the Firebase ToS.
I think there are two issues at play here: 1) why are we receiving “PERMISSION_DENIED” for ToS when it doesn’t exist - likely an issue with our firestore.rules and 2) why does the app fail silently on subsequent login attempts. Thanks for offering to help!