I'm using firebase firestore to make a query on my...
# coroutines
c
I'm using firebase firestore to make a query on my application start. I actually am making 4 simulataneous queries. But 1 of them fails and I get a stacktrace that's unhelpful in terms of finding which of my 4 queries is the culprit. I think it's because I'm using a coroutine? Here is my code
Copy code
fun doThing() {
  viewModelScope.launch {
    repository.getDocument()
...
Copy code
suspend fun getDocument() {
  return FirebaseFirestore.getInstance()
      .collection("mycollec")
      .document("mydoc")
      .get()
      .await()
      .toObject<MyDoc>()
}
Any idea why the stacktrace I get doesn't point to the code above at all?
r
What's the stack trace?
c
message has been deleted
Literally nothing ends up pointing to my code. Feels like when I was using RxJava and I couldn't get a good stacktrace so I ended up using: https://github.com/uber/RxDogTag
so yeah. just curious if this is a coroutine specific thing.
j
I think it's because the exception is thrown from one of firebase's background threads. It is not really in the hands of the coroutines library or Rx
r
@Colton Idle Just from experience with Firestore, this exception is letting you know that your Firestore security rules (https://firebase.google.com/docs/firestore/security/get-started) is causing data access to be refused. If you're not sure which collection request is being denied, try them one by one just to test.
c
yeah. i understand the exception. i just want to know where its coming from. seems insane that you can't get a stack leading to the exact call. In my case, I put a try catch around all calls. rethrow the exception. and now i get a proper trace. crappy but it works.