You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Unity集成Firebase邮箱/密码认证时出现内部错误的排查求助

Unity集成Firebase邮箱/密码认证时出现内部错误的排查求助

我一直在尝试给我的Unity项目集成Firebase认证功能,但每次登录我在Firebase控制台创建的测试账号时,都会遇到同一个错误:

An internal error has occurred

按钮点击时触发的函数如下:

public async void LoginButton()
{
    await SignIn(emailField.text, passwordField.text);
}

而SignIn函数的实现是这样的:

public async Task<bool> SignIn(string email, string password)
{
    try
    {
        var result = await auth.SignInWithEmailAndPasswordAsync(email, password);
        user = result.User;
        Debug.Log($"User signed in successfully: {user.Email}");
        return true;
    }
    catch (FirebaseException e)
    {
        Debug.LogError($"Failed to sign in: {e.Message}");
        return false;
    }
}

Firebase的配置我应该是做对了——Google-services文件已经放在了Unity项目的Assets/Firebase路径下。

我还做了个测试:如果留空输入框,会收到不同的错误提示。比如邮箱为空时,会显示“邮箱格式不正确”,这说明函数本身应该没问题,问题可能出在Firebase端,但我完全不知道该怎么排查Firebase里的问题。目前邮箱/密码认证方式已经启用,控制台里的各项配置看起来都正常。


Edit:

这里是完整的调用栈:

Failed to sign in: An internal error has occurred. 0x00007ffca537616d
(Unity) StackWalker::ShowCallstack 0x00007ffca5386129 (Unity)
PlatformStacktrace::GetStacktrace 0x00007ffca65ef76e (Unity)
Stacktrace::GetStacktrace 0x00007ffca6b97faf (Unity) DebugStringToFile
0x00007ffca44a1625 (Unity) DebugLogHandler_CUSTOM_Internal_Log
0x000001d51f42e8cd (Mono JIT Code) (wrapper managed-to-native)
UnityEngine.DebugLogHandler:Internal_Log_Injected
(UnityEngine.LogType,UnityEngine.LogOption,UnityEngine.Bindings.ManagedSpanWrapper&,intptr)
0x000001d51f42e793 (Mono JIT Code)
UnityEngine.DebugLogHandler:Internal_Log
(UnityEngine.LogType,UnityEngine.LogOption,string,UnityEngine.Object)
0x000001d51f42e3cb (Mono JIT Code)
UnityEngine.DebugLogHandler:LogFormat
(UnityEngine.LogType,UnityEngine.Object,string,object[])
0x000001d51f42e150 (Mono JIT Code) UnityEngine.Logger:Log
(UnityEngine.LogType,object) 0x000001d5c3016055 (Mono JIT Code)
UnityEngine.Debug:LogError (object) 0x000001d5c300fe2b (Mono JIT Code)
Auth/d__7:MoveNext () (at ***/Assets/Scripts/Auth.cs:56)
0x000001d4d8d28cd2 (Mono JIT Code)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext
(object) 0x000001d4477c5cfe (Mono JIT Code)
System.Threading.ExecutionContext:RunInternal
(System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
0x000001d4477c586b (Mono JIT Code)
System.Threading.ExecutionContext:Run
(System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
0x000001d4d8d28b8b (Mono JIT Code)
System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run
() 0x000001d5c30157aa (Mono JIT Code)
System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object)
0x000001d4f9977e05 (Mono JIT Code)
System.Threading.Tasks.AwaitTaskContinuation:RunCallback
(System.Threading.ContextCallback,object,System.Threading.Tasks.Task&)
0x000001d4f9977a73 (Mono JIT Code)
System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run
(System.Threading.Tasks.Task,bool) 0x000001d448a50e33 (Mono JIT Code)
System.Threading.Tasks.Task:FinishContinuations () 0x000001d448a50a63
(Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree ()
0x000001d448a503f3 (Mono JIT Code)
System.Threading.Tasks.Task:FinishStageTwo () 0x000001d448a5004b (Mono
JIT Code) System.Threading.Tasks.Task:Finish (bool) 0x000001d5c30146bb
(Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object)
0x000001d5c3015ecb (Mono JIT Code)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<TResult_REF>:SetException (System.Exception) 0x000001d5c301028b (Mono JIT Code) Firebase.Auth.FirebaseAuth/<SignInWithEmailAndPasswordAsync>d__51:MoveNext () 0x000001d4d8d28cd2 (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object) 0x000001d4477c5cfe (Mono JIT Code) System.Threading.ExecutionContext:RunInternal (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4477c586b (Mono JIT Code) System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool) 0x000001d4d8d28b8b (Mono JIT Code) System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:Run () 0x000001d5c30157aa (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:InvokeAction (object) 0x000001d4f9977e05 (Mono JIT Code) System.Threading.Tasks.AwaitTaskContinuation:RunCallback (System.Threading.ContextCallback,object,System.Threading.Tasks.Task&) 0x000001d4f9977a73 (Mono JIT Code) System.Threading.Tasks.SynchronizationContextAwaitTaskContinuation:Run (System.Threading.Tasks.Task,bool) 0x000001d448a50e33 (Mono JIT Code) System.Threading.Tasks.Task:FinishContinuations () 0x000001d448a50a63 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageThree () 0x000001d448a503f3 (Mono JIT Code) System.Threading.Tasks.Task:FinishStageTwo () 0x000001d448a5004b (Mono JIT Code) System.Threading.Tasks.Task:Finish (bool) 0x000001d5c30146bb (Mono JIT Code) System.Threading.Tasks.Task:TrySetException (object) 0x000001d5c30145ab (Mono JIT Code) System.Threading.Tasks.TaskCompletionSource`1<TResult_REF>:TrySetException
(System.Exception) 0x000001d5c30144f3 (Mono JIT Code)
System.Threading.Tasks.TaskCompletionSource`1<TResult_REF>:SetException (System.Exception) 0x000001d5c3013dd3 (Mono JIT Code) Firebase.Auth.Future_AuthResult/<>c__DisplayClass5_0:<GetTask>b__0 () 0x000001d5c301331d (Mono JIT Code) Firebase.Auth.Future_AuthResult:SWIG_CompletionDispatcher (int) 0x000001d5c301255b (Mono JIT Code) (wrapper native-to-managed) Firebase.Auth.Future_AuthResult:SWIG_CompletionDispatcher (int) 0x00007ffcc4daee18 (FirebaseCppApp-12_5_0)  0x00007ffcc4e0d718 (FirebaseCppApp-12_5_0) uS::Socket::freeMessage 0x000001d5c0841657 (Mono JIT Code) (wrapper managed-to-native) Firebase.AppUtilPINVOKE:PollCallbacks () 0x000001d5c084156b (Mono JIT Code) Firebase.AppUtil:PollCallbacks () 0x000001d5c084150b (Mono JIT Code) Firebase.Platform.FirebaseAppUtils:PollCallbacks () 0x000001d5c0841153 (Mono JIT Code) Firebase.Platform.FirebaseHandler:Update () 0x000001d5c084100b (Mono JIT Code) Firebase.Platform.FirebaseMonoBehaviour:Update () 0x000001d57f6c77e8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr) 0x00007ffcb9c8697e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445) 0x00007ffcb9bc8444 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068) 0x00007ffcb9bc8530 (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115) 0x00007ffca529a1a4 (Unity) scripting_method_invoke 0x00007ffca5272073 (Unity) ScriptingInvocation::Invoke 0x00007ffca525d1e4 (Unity) MonoBehaviour::CallMethodIfAvailable 0x00007ffca525d312 (Unity) MonoBehaviour::CallUpdateMethod 0x00007ffca4c8937c (Unity) BaseBehaviourManager::CommonUpdate<BehaviourManager> 0x00007ffca4c909aa (Unity) BehaviourManager::Update 0x00007ffca4f19a7d (Unity) `InitPlayerLoopCallbacks'::`2'::UpdateScriptRunBehaviourUpdateRegistrator::Forward
0x00007ffca4ee7cc7 (Unity) ExecutePlayerLoop 0x00007ffca4ee7e37
(Unity) ExecutePlayerLoop 0x00007ffca4eecf6f (Unity) PlayerLoop
0x00007ffca5feda9a (Unity) EditorPlayerLoop::Execute
0x00007ffca6004937 (Unity) PlayerLoopController::InternalUpdateScene
0x00007ffca60066ed (Unity)
PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ffca60004f1 (Unity) Application::TickTimer 0x00007ffca65f447a
(Unity) MainMessageLoop 0x00007ffca65fa152 (Unity) UnityMain
0x00007ff76afa2fba (Unity) __scrt_common_main_seh 0x00007ffd7190259d
(KERNEL32) BaseThreadInitThunk 0x00007ffd7340af38 (ntdll)
RtlUserThreadStart

备注:内容来源于stack exchange,提问作者user21574373

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.15 03:44:57