Firestore via Unity SDK & debug logging

442 views
Skip to first unread message

Michael Bayne

unread,
Jun 1, 2020, 7:35:58 PM6/1/20
to Firebase Google Group
Hi,

We're using the Unity SDK for our Unity project and using the new (alpha) Firestore library. About two weeks ago, the game stopped being able to connect to Firestore when built and run on iOS (works fine on Android & desktop). It fails with the following error:

```
2020-06-01 13:44:03.828980-0700 empowered[7475:8468832] 6.21.0 - [Firebase/Firestore][I-FST000001] Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
 This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
```

This happens on half a dozen devices on half a dozen different networks, so it's certainly not a networking issue. The same app uses a separate connection to our game server which is fine. So obviously there's some other underlying error that is manifesting as Firebase thinking its network connection failed.

As I mentioned earlier everything works fine for Android builds, and when running in the Unity editor on the desktop.

I've scoured the Internet for clues, and double checked that nothing is weird with our Firebase app configuration, I've checked the Google API console and it doesn't show any obvious problems, all the various keys and certificates and miscellaneous plumbing seems fine, not to mention nothing has changed with our app configuration between when it worked and when it stopped working.

I have also, to no avail, attempted to enable debug logging in the Firestore SDK. `FirebaseFirestore` as a `LogLevel` property that I've set to `Verbose`, but it doesn't log anything other than what I'm already seeing. I have seen reports from people using the native iOS SDK showing _much_ more detailed debug logging but I cannot seem to enable that. I even tried hacking in code into the generated Xcode project to try to enable Firestore debug logging from there, but my knowledge of the twisty maze of build settings and include files and Podfiles and whatnot were insufficient to get that working.

So here I am, hat in hand, wondering if anyone has any advice.

Thanks,
Michael

martin...@google.com

unread,
Jun 16, 2020, 2:31:25 PM6/16/20
to Firebase Google Group
Hi Michael!

The team has found and is tracking the logging issue you ran into.

For Firestore, can I gather some additional information? Most notably: I want to make sure that you're on the latest Unity SDK (currently 6.15), that you have a GoogleService-Info.plist (feel free to download it again just in case), and that you're using the correct iOS bundle id (matching what you have in the Firebase Console).

Additionally, I'll copy/paste our GitHub issue template. If you wouldn't mind filling it out, the most important bits are your current platform/configuration (top section) and whether or not you see the behaviour in the sample project:

### Please fill in the following fields:
Unity editor version: 
Firebase Unity SDK version: 
Source you installed the SDK (.unitypackage or Unity Package Manager):
Firebase plugins in use (Auth, Database, etc.):
Additional SDKs you are using (Facebook, AdMob, etc.): 
Platform you are using the Unity editor on (Mac, Windows, or Linux): 
Platform you are targeting (iOS, Android, and/or desktop): 
Scripting Runtime (Mono, and/or IL2CPP):

### Please describe the issue here:
(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.)

### Please answer the following, if applicable:
Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?

What's the issue repro rate? (eg 100%, 1/5 etc)

Thanks,
--Patrick

m...@google.com

unread,
Jun 17, 2020, 2:40:33 PM6/17/20
to Firebase Google Group
We just realized that debug logging was broken recently in the Unity SDK on iOS--we're working on a fix. You can enable it manually on iOS with a source change by adding a line before this point:


diff --git a/Firestore/core/src/core/firestore_client.cc b/Firestore/core/src/core/firestore_client.cc
index 248e736ce..9e2a98f1b 100644
--- a/Firestore/core/src/core/firestore_client.cc
+++ b/Firestore/core/src/core/firestore_client.cc
@@ -108,6 +108,9 @@ std::shared_ptr<FirestoreClient> FirestoreClient::Create(
     std::shared_ptr<auth::CredentialsProvider> credentials_provider,
     std::shared_ptr<util::Executor> user_executor,
     std::shared_ptr<util::AsyncQueue> worker_queue) {
+
+  util::LogSetLevel(util::kLogLevelDebug);
+
   // Have to use `new` because `make_shared` cannot access private constructor.
   std::shared_ptr<FirestoreClient> shared_client(
       new FirestoreClient(database_info, std::move(credentials_provider),

What this does is forces logging enabled early in the construction of the C++ client underlying the Unity SDK and could help gather clues about what's going wrong.

Rather than filling out the GitHub issue template in email you might consider just filing your response as an issue.

Cheers,
-Gil
Reply all
Reply to author
Forward
0 new messages