firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
226 stars 37 forks source link

[Bug] Unable to load Firebase app options: missing or malformed while it's there and correct (Desktop) #568

Closed PortgateStudios closed 1 year ago

PortgateStudios commented 3 years ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

On some of my users's PC (possibly all of them are Windows users, but who knows) FirebaseApp just fails to be created. It fails to load the FirebaseApp options, this is what it says on startup:

Unable to load Firebase app options ([Application_Data/StreamingAssets\google-services-desktop.json, Application_Data/StreamingAssets\google-services.json] are missing or malformed)

And when I first get FirebaseFirestore.DefaultInstance and it tries to create it, it throws this exception because there are no options loaded:

InitializationException:  Firebase app creation failed.
  at Firebase.FirebaseApp.CreateAndTrack (Firebase.FirebaseApp+CreateDelegate createDelegate, Firebase.FirebaseApp existingProxy) [0x000e3] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.FirebaseApp.Create () [0x00027] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.FirebaseApp.get_DefaultInstance () [0x00017] in <348e5429a2d04280bc0cb46752ede7db>:0 
  at Firebase.Firestore.FirebaseFirestore.get_DefaultInstance () [0x00000] in <b004a94077e84d5c87ca4c668ed59347>:0 
  at FirebaseSystem.AddDocument (System.String collectionName, System.Collections.Generic.Dictionary`2[TKey,TValue] documentData, System.Action`1[T] onSuccess, System.String extraInfo) [0x0002c] in <a86eca02e20e4b89aadd008b280117df>:0 
  at FirebaseSystem.SendGameEnd (System.Collections.Generic.Dictionary`2[TKey,TValue] gameEndData, System.Action`1[T] onSuccess) [0x00130] in <a86eca02e20e4b89aadd008b280117df>:0 
  at GameManager.SendGameEnd () [0x000c8] in <a86eca02e20e4b89aadd008b280117df>:0 
...

I checked and I had the same google-services-desktop.json there as them. I even told them to replace theirs with mine, maybe there is an "invisible character" in theirs. But no, it still couldn't be loaded. And only small part of the player base reported this issue.

Steps to reproduce:

I couldn't reproduce it, because it's only happening on their PC.

Relevant Code:

All the Firebase stuff I have at startup is just:
`FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(continuationAction: task =>
{
    FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);
});`

And this is where it crashes, because it fails to create the FirebaseApp because there are no options loaded.

var db = FirebaseFirestore.DefaultInstance;

paulinon commented 3 years ago

Hi @PortgateStudios,

From the error message you provided, it seems that the configuration file can't be detected. I've found a Stack Overflow post that talks about this, and some causes of it are special characters in the file path or the config file not exactly named "google-services.json". With that, please ensure that your users' configurations don't have any of these mistakes.

I'll be closing this for now. Feel free to comment if the issue persists so that this ticket can be reopened.

Thanks!

PortgateStudios commented 3 years ago

Yes, I created a special folder called Ádám (common Hungarian name), put the application inside that, and now the app options couldn't be loaded...

Great, at least now I can do a workaround this.

As I see this isn't a new issue. Why isn't thix fixed yet and is there an estimation about it?

Cheers!

paulinon commented 3 years ago

Hi @PortgateStudios,

I have filed an internal request for this issue. I don't have any timelines for the fix, so I'll be leaving this open for now.

Thanks.

AlmostMatt commented 1 year ago

Duplicate of #405