Comments (12)
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
from firebase-unity-sdk.
Hey @Nyankoo, thanks for reaching out. I was able to reproduce the same behavior. Oddly enough, when I tested this on a native android app, this is working alright. I'm guessing there might be a miscommunication between the different Firebase products with AppCheck in Unity. I'll go ahead and inform our engineers. Thanks!
from firebase-unity-sdk.
@argzdev Glad it could also be reproduced on your end and I hope for a fix soon, as it makes testing in the Unity Editor quite hard.
from firebase-unity-sdk.
Hi @Nyankoo, so while I was waiting for engineering feedback. I noticed that after testing today, the issue went away. Upon further investigation, it looks like the issue was due to multiple reasons:
- Delayed "reaction" of the debug token from the App Check services, which was interpreted by the system as unverified requests.
- AppCheck does not work when testing it in the default Unity IDE. I noticed a different behavior where on the Unity IDE Firestore fails to write a document, and on the Android Emulator the Firestore write was able to go through. In this case, you'd have to Build and Run the app on an Android Emulator.
- Lastly, I noticed my Firestore rules was restricting the writing of the document. You could try isolating the issue by first testing without AppCheck and see if everything is working correctly. Perhaps this will isolate the issue.
Also I've tested using our quickstart for Firestore and added AppCheck:
protected virtual void Start()
{
FirebaseApp.CheckAndFixDependenciesAsync().ContinueWithOnMainThread(task =>
{
dependencyStatus = task.Result;
if (dependencyStatus == DependencyStatus.Available)
{
InitializeFirebase();
InitializeAppCheck();
}
else
{
Debug.LogError(
"Could not resolve all Firebase dependencies: " + dependencyStatus);
}
});
}
Let me know if this helps!
from firebase-unity-sdk.
@argzdev Can you please elaborate on reason 2? App Check was working previously in the Unity Editor with the instructions found here:
https://firebase.google.com/docs/app-check/unity/debug-provider
It also explicitly states:
After you have registered your app for App Check, your app normally won't run on desktop platforms, in an emulator, or from a continuous integration (CI) environment, since those environments don't qualify as valid devices. If you want to run your app in such an environment during development and testing, you can create a debug build of your app that uses the App Check debug provider instead of a real attestation provider.
from firebase-unity-sdk.
Reason #2 was the behavior I encountered when testing for both Unity and in Android Emulator. I believe you're right, it should be working even on desktop platforms as mentioned in the documentations. So I'm guessing the main culprit is that the Debug token doesn't work on the desktop platform, but works on the Android Emulator. Let me add that to my escalation for our engineers.
By the way, you mentioned that it was previously working. Could you specify which version were you using before encountering this behavior?
from firebase-unity-sdk.
I do believe that it was working with 11.8.1, but this could also be a mix-up with recent changes of enforcement we did on the Firebase dashboard.
from firebase-unity-sdk.
We'll keep that in mind while investigating, thank you for the additional information!
from firebase-unity-sdk.
Hi @Nyankoo
I tried it on my end, and it does work on my end without issue. I can get that error message by not setting up the DebugAppCheckProviderFactory correctly, so that is my best guess on what could be going wrong. It is important to note that setting the factory needs to be done before any other Firebase call.
Somethings to try, you could enable debug logging to see if anything stands out in the log about what AppCheck provider is being used with the calls.
Firebase.FirebaseApp.LogLevel = Firebase.LogLevel.Debug;
from firebase-unity-sdk.
@a-maurice I just tried it too, and it's still not working for me. Which Unity version did you try it with?
Here is my code:
DebugAppCheckProviderFactory.Instance.SetDebugToken("MYDEBUGTOKEN"); //This is set to the correct debug token
FirebaseAppCheck.SetAppCheckProviderFactory(DebugAppCheckProviderFactory.Instance);
var dependencyStatus = await FirebaseApp.CheckAndFixDependenciesAsync();
if(dependencyStatus != DependencyStatus.Available)
{
return;
}
//do Firebase calls after this
from firebase-unity-sdk.
I tried it with 2021.3.38f1, and had previously done tests with 2021.3.13f1, so I doubt that would be part of the reason why. And yeah, that code looks like the correct order for things.
I do see that the Firestore SDK updated some of their dependencies in the iOS SDK, which is partially used by the desktop implementation, though looking over those changes nothing seems like it would be related to App Check issues. I assume it is all the calls to Firestore having issues, and not just a specific one? Are you using any of the other Firebase products that use App Check (Storage, Realtime Database, Functions), to see if those are working for you?
from firebase-unity-sdk.
@a-maurice Only using Firestore that has App Check "enforced".
The additional debug message I'm getting is: "Would set key-value if running on a physical device: KEY-VALUE"
from firebase-unity-sdk.
Related Issues (20)
- [Bug] iOS crashes when Google sign in is not enabled HOT 2
- [Bug] SignIn With Facebook Exception: Bad access token: {"code":190,"message":"Invalid OAuth access token - Cannot parse access token"} HOT 2
- [Bug] SIGSEGV - Pure virtual function called! HOT 9
- [Bug] SIGSEGV - firebase::Mutex::Acquire() HOT 2
- [Bug] SIGSEGV - FORTIFY: pthread_mutex_lock called on a destroyed mutex (0x<sanitized>) HOT 2
- [Bug] Undefined symbol errors with Firebase SDK v 11.9.0 HOT 1
- [FR]: Add ReadOnlySpan-based overload for FirebaseAnalytics.LogEvent HOT 2
- [Bug] Firebase Messaging & Unity 6 - Not receiving notifications on Android HOT 8
- Firebase HOT 3
- [Question] INVALID_APP_ID error on Android HOT 8
- [Question] i don't know why please check URL HOT 4
- [Bug] DllNotFoundException: FirebaseCppApp-11_6_0 in Windows 10 HOT 8
- [Bug] Persistent connection error thrown when using Unity 2022 on Mac HOT 3
- [Bug] Problem with dependency resolution for Android and Unity 6000.0.1 HOT 12
- [Bug] Invalid mainTemplate.gradle for Unity 6000.0 HOT 7
- [Bug] Crash [libFirebaseCppApp-12_0_0.so] firebase::Mutex::Acquire() HOT 5
- [Question] Firebase - NoClassDefFoundError at startup HOT 6
- [Bug] Processing Libraries from Forced Resolution popup won't disappear HOT 3
- [Question] Firestore throws "Cursor has too many values" exception when running an aggregate count query that starts at a specific document HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from firebase-unity-sdk.