quickstart-unity icon indicating copy to clipboard operation
quickstart-unity copied to clipboard

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

Open PortgateStudios opened this issue 4 years ago • 3 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.2.1f1
  • Firebase Unity SDK version: 6.15.1 and 7.1.0
  • Source you installed the SDK: Unity Package Manager (.unitypackage or Unity Package Manager)
  • Problematic Firebase Component: FirebaseApp (Auth, Database, etc.)
  • Other Firebase Components in use: FirebaseAnalytics, FirebaseFirestore, FirebaseFunctions (Auth, Database, etc.)
  • Additional SDKs you are using: Steamworks but even if it's not included in the build, it still happens (Facebook, AdMob, etc.)
  • Platform you are using the Unity editor on: Windows (Mac, Windows, or Linux)
  • Platform you are targeting: Desktop (iOS, Android, and/or desktop)
  • Scripting Runtime: IL2CPP (Mono, and/or IL2CPP)

[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;

PortgateStudios avatar Mar 24 '21 08:03 PortgateStudios

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!

paulinon avatar Mar 24 '21 13:03 paulinon

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!

PortgateStudios avatar Mar 24 '21 16:03 PortgateStudios

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.

paulinon avatar Apr 16 '21 16:04 paulinon