firebase-unity-sdk icon indicating copy to clipboard operation
firebase-unity-sdk copied to clipboard

[Bug] Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject

Open RubDevRG opened this issue 1 month ago • 4 comments

Description

Hey, I’m currently working more actively on getting App Check running properly in my live project. I’ve added several detailed log outputs around my initialization process to better understand what’s happening and to enforce App Check sooner or later.

This is the most common App Check error I’m encountering at the moment, and I haven’t been able to find any information on how to resolve it:

App Check Provider: Play Integrity Affected Users: ~15% Happens on regular Samsung phones as well, so nothing unusual.

Reproducing the issue

Hard to reproduce locally since it’s affecting specific users in the live build. In general, it’s just a standard Firebase installation with App Check and Play Integrity for Android.

Firebase Unity SDK Version

13.4.0

Unity editor version

6000.0.60f1

Installation Method

.unitypackage

Problematic Firebase Component(s)

App Check

Other Firebase Component(s) in use

Analytics

Additional SDKs you are using

No response

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

Relevant Log Output

<Warning>: App Check init failed: System.AggregateException: One or more errors occurred. (Provider returned an Exception: System.AggregateException: One or more errors occurred. (Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject) ---> Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject<---
) ---> Firebase.FirebaseException: Provider returned an Exception: System.AggregateException: One or more errors occurred. (Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject) ---> Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject<---

   --- End of inner exception stack trace ---
  at Firebase.AppCheck.FirebaseAppCheck+<>c.<GetAppCheckTokenAsync>b__13_0 (System.Threading.Tasks.Task`1[TResult] task) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2[TAntecedentResult,TResult].InnerInvoke () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task.Execute () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task.ExecuteWithThreadLocal (System.Threading.Tasks.Task& currentTaskSlot) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.Tasks.Task.ExecuteEntry (System.Boolean bPreventDoubleExecution) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00000] in <00000000000000000000000000000000>:0 
--- End of stack trace from previous location where exception was thrown ---

  at FirebaseSetup.InitializeAsyncInternal () [0x00000] in <00000000000000000000000000000000>:0 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00000] in <00000000000000000000000000000000>:0 
  at UnityEngine.UnitySynchronizationContext.Exec () [0x00000] in <00000000000000000000000000000000>:0 
---> (Inner Exception #0) Firebase.FirebaseException: Provider returned an Exception: System.AggregateException: One or more errors occurred. (Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject) ---> Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Firebase.FirebaseException: Value <!DOCTYPE of type java.lang.String cannot be converted to JSONObject<---
<---

If using CocoaPods for Apple platforms, the project's Podfile.lock

No response

RubDevRG avatar Oct 30 '25 02:10 RubDevRG