Description
Cloud functions can only be invoked from the main thread due to attaching the X-Firebase-AppVersion header using the value supplied from UnityEngine.Application.version, accessing that value from outside the main thread will cause an exception.
These non-main-thread function invocations used to work on SDK v13.5.0, I believe the recent functions serialization logic in SDK v13.10.0 probably caused this.
Reproducing the issue
Call any cloud function from outside the main thread
Firebase Unity SDK Version
13.15.0
Unity editor version
6000.3.8f1
Installation Method
Unity Package Manager
Problematic Firebase Component(s)
Functions
Other Firebase Component(s) in use
Analytics, Authentication, Crashlytics, Firestore, Messaging, Remote Config, Storage
Additional SDKs you are using
No response
Targeted Platform(s)
Android, Apple Platforms
Unity editor platform
Windows
Scripting Runtime
IL2CPP
Release Distribution Type
Pre-built SDK from https://firebase.google.com/download/unity
Relevant Log Output
UnityException: get_version can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Application.get_version () (at <00000000000000000000000000000000>:0)
Firebase.Internal.HttpHelpers.SetRequestHeaders (System.Net.Http.HttpRequestMessage request, Firebase.FirebaseApp firebaseApp, System.String authPrefix, System.Boolean limitedUseAppCheckTokens) (at ./Library/PackageCache/com.google.firebase.app@f37c8a4637b5/Firebase/FirebaseApp/Internal/HttpHelpers.cs:35)
If using CocoaPods for Apple platforms, the project's Podfile.lock
No response
Description
Cloud functions can only be invoked from the main thread due to attaching the
X-Firebase-AppVersionheader using the value supplied fromUnityEngine.Application.version, accessing that value from outside the main thread will cause an exception.These non-main-thread function invocations used to work on SDK v13.5.0, I believe the recent functions serialization logic in SDK v13.10.0 probably caused this.
Reproducing the issue
Call any cloud function from outside the main thread
Firebase Unity SDK Version
13.15.0
Unity editor version
6000.3.8f1
Installation Method
Unity Package Manager
Problematic Firebase Component(s)
Functions
Other Firebase Component(s) in use
Analytics, Authentication, Crashlytics, Firestore, Messaging, Remote Config, Storage
Additional SDKs you are using
No response
Targeted Platform(s)
Android, Apple Platforms
Unity editor platform
Windows
Scripting Runtime
IL2CPP
Release Distribution Type
Pre-built SDK from https://firebase.google.com/download/unity
Relevant Log Output
If using CocoaPods for Apple platforms, the project's Podfile.lock
No response