heroiclabs / nakama-unity

Unity client for Nakama server.
https://heroiclabs.com/docs/unity-client-guide
Other
411 stars 75 forks source link

WebGL builds crash on call to AuthenticateFacebookAsync #101

Closed DaveOak closed 3 years ago

DaveOak commented 3 years ago

The error "UnityLoader.js:4 To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking" is displayed on the call to AuthenticateFacebookAsync from the code below.

This is with nakama-unity 2.7.0, Unity 2019.4.17f1 and Chrome 87.0.4280.88.

 using System;
 using Nakama;
 using UnityEngine;

 public class NakamaManager : MonoBehaviour
 {
    private readonly IClient _client = new Client("http", "<URL>", 7350, "defaultkey");
    private ISession _session;

    void Start()
    {
        AuthenticateFacebook("<ACCESS TOKEN>");
    }

    internal async void AuthenticateFacebook(string accessToken)
    {
        try
        {
            Debug.LogFormat("NakamaController before AuthenticateFacebook {0}", accessToken);
            _session = await _client.AuthenticateFacebookAsync(accessToken, null, true);
            Debug.LogFormat("NakamaController after AuthenticateFacebook {0}", _session.UserId);
        }
        catch (Exception e)
        {
            Debug.LogException(e);
        }
    }
 }
DaveOak commented 3 years ago

The following call stack is from FireFox, running the test as a development build with debug symbols. In this case it is calling AuthenticateEmailAsync but the error is the same.


An error occurred running the Unity content on this page. See your browser JavaScript console for more info. The error was:
uncaught exception: abort("To use dlopen, you need to use Emscripten's linking support, see https://github.com/kripken/emscripten/wiki/Linking") at jsStackTrace (test4.wasm.framework.unityweb:729:12)
stackTrace (test4.wasm.framework.unityweb:743:11)
onAbort@http://oddsocksgame.com/test/test4/Build/UnityLoader.js:1145:50
abort (test4.wasm.framework.unityweb:25322:10)
_dlopen (test4.wasm.framework.unityweb:8978:7)
__ZN6il2cpp2osL19LoadLibraryWithNameEPKci (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[43075]:0xac80d3)
__ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEEi (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[43074]:0xac7fdf)
__ZN6il2cpp2os13LibraryLoader18LoadDynamicLibraryERKNS_5utils10StringViewIcEE (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[43073]:0xac7f39)
__ZN6il2cpp2vm13LibraryLoader18LoadDynamicLibraryENS_5utils10StringViewIcEE (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[44880]:0xb04983)
__ZN6il2cpp2vm14PlatformInvoke7ResolveERK16PInvokeArguments (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[44979]:0xb08baf)
__Z22il2cpp_codegen_resolveRK16PInvokeArguments (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[46017]:0xb2c831)
__Z30il2cpp_codegen_resolve_pinvokeIPFiPhiELm5ELm14EET_RAT0__KcRAT1__S4_20Il2CppCallConvention13Il2CppCharSetib (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[22982]:0x6ecc38)
_CommonUnixIPGlobalProperties_getdomainname_mF48E7AAE74313578ACC25E8C9FBAAD66F280DDCD (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[22981]:0x6ecbaf)
dynCall_iiii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[47984]:0xb73e33)
UnityModule [UnityModule/Module.dynCall_iiii] (test4.wasm.framework.unityweb:24210:39)
invoke_iiii (test4.wasm.framework.unityweb:15986:17)
_CommonUnixIPGlobalProperties_get_DomainName_m8F359828BAB5DC5F338C2384908E2D34799BAE86 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[22985]:0x6eccdf)
__ZN16VirtFuncInvoker0IP8String_tE6InvokeEjP12Il2CppObject (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[18903]:0x6534c6)
_CookieContainer__ctor_m4FD264ED607530C02A9BA429752A35CD30E7757F (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[31364]:0x8a3c6a)
_HttpClientHandler_get_CookieContainer_mA0C918C1C2B34DB0BCD2592B456CFE8886F2887F (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26716]:0x7b4edb)
_HttpClientHandler_CreateWebRequest_mCE668210BC0E2767FB22053107AD3E073BD574D8 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26719]:0x7b5175)
__ZN16VirtFuncInvoker1IP52ByteU5BU5D_tD06FDBE8142446525DF1C40351D523A228373821P8String_tE6InvokeEjP12Il2CppObjectS3_ (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[19121]:0x65daa5)
dynCall_iiii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[47984]:0xb73e33)
UnityModule [UnityModule/Module.dynCall_iiii] (test4.wasm.framework.unityweb:24210:39)
invoke_iiii (test4.wasm.framework.unityweb:15986:17)
_U3CSendAsyncU3Ed__64_MoveNext_m836A75889BE6034DFE84C350C12D0B77A1E8CC5F (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26740]:0x7b6238)
dynCall_vii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[48072]:0xb74769)
UnityModule [UnityModule/Module.dynCall_vii] (test4.wasm.framework.unityweb:24650:38)
invoke_vii (test4.wasm.framework.unityweb:16866:10)
_AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncU3Ed__64_t27F5FC426FC9AF2DEA087F38EB6F330957AC16F0_m16AD21D2A219E0D80BE56612D02A7BFB66A88263_gshared (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[18647]:0x63f0a6)
__Z138AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncU3Ed__64_t27F5FC426FC9AF2DEA087F38EB6F330957AC16F0_mCA7B198FBB8E40E6A11AC4DAB4CEFC64D5042BDEP66AsyncTaskMethodBuilder_1_t0E64AA6FA425130501B776CD7A27C0B3FD630DF0P62U3CSendAsyncU3Ed__64_t27F5FC426FC9AF2DEA087F38EB6F330957AC16F0PK10MethodInfo (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26736]:0x7b5ee1)
_HttpClientHandler_SendAsync_m085FCB5C9C14B23E2904A005C9161B7AD9109DDC (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26735]:0x7b5ebf)
__ZN16VirtFuncInvoker2IP48Task_1_t519CB3A303B53176BD616AC273201D66B84FF270P60HttpRequestMessage_tBBC9EBC5D6C1B7E30F9927AABBDB65792FFB542759CancellationToken_t9E956952F7F20908F2AE72EDF36D97E6C7DB63ABE6InvokeEjP12Il2CppObjectS3_S4_ (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26363]:0x7a382f)
_HttpMessageInvoker_SendAsync_mE5B5A6FF6EAC72CDC08D1E438038A2DD19CEA86C (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26706]:0x7b42a5)
_HttpClient_U3CU3En__0_m150329FAA6EF05F000DDDA06E6302DEE4B05F17A (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26705]:0x7b425b)
dynCall_iiiii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[47988]:0xb73ea1)
UnityModule [UnityModule/Module.dynCall_iiiii] (test4.wasm.framework.unityweb:24230:40)
invoke_iiiii (test4.wasm.framework.unityweb:16026:17)
_U3CSendAsyncWorkerU3Ed__47_MoveNext_m1B93D3A5DCCE4BE2C359DFA5B487EF697CE4DE2E (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26707]:0x7b4583)
dynCall_vii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[48072]:0xb74769)
UnityModule [UnityModule/Module.dynCall_vii] (test4.wasm.framework.unityweb:24650:38)
invoke_vii (test4.wasm.framework.unityweb:16866:10)
_AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncWorkerU3Ed__47_t47F0FB04707E1418B40449E9FC6FE1F2FEAB0941_mFFB349C5B59A5AE82B0A5FEF5553B23BC36E7F94_gshared (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[18644]:0x63ef1b)
__Z144AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncWorkerU3Ed__47_t47F0FB04707E1418B40449E9FC6FE1F2FEAB0941_mB0AEB49FA37F2ADF951229DEE0027088BBD7937DP66AsyncTaskMethodBuilder_1_t0E64AA6FA425130501B776CD7A27C0B3FD630DF0P68U3CSendAsyncWorkerU3Ed__47_t47F0FB04707E1418B40449E9FC6FE1F2FEAB0941PK10MethodInfo (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26701]:0x7b4007)
_HttpClient_SendAsyncWorker_m55F4C8238A2EC911E989D819C5B098C1CEB281D4 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26700]:0x7b3fe5)
_HttpClient_SendAsync_m7E97D0E342056559AE16E2723AA2502D0440B9A2 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26696]:0x7b3d44)
_HttpClient_SendAsync_mF271621C7E6EAD6FC8DE115237A317BA14820254 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[26695]:0x7b3ab7)
dynCall_iiii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[47984]:0xb73e33)
UnityModule [UnityModule/Module.dynCall_iiii] (test4.wasm.framework.unityweb:24210:39)
invoke_iiii (test4.wasm.framework.unityweb:15986:17)
_U3CSendAsyncU3Ed__6_MoveNext_mDF6C96442BD3B81FF2C635B074EA3AA9F3E54812 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[19710]:0x67c080)
dynCall_vii (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[48072]:0xb74769)
UnityModule [UnityModule/Module.dynCall_vii] (test4.wasm.framework.unityweb:24650:38)
invoke_vii (test4.wasm.framework.unityweb:16866:10)
_AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncU3Ed__6_t6720512E6DD10EF0D901252321398CC3ABF9FEBC_m1C67377BC2EB20D7273FF153FD3B15B47D4AF0DB_gshared (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[18572]:0x63ca13)
__Z137AsyncTaskMethodBuilder_1_Start_TisU3CSendAsyncU3Ed__6_t6720512E6DD10EF0D901252321398CC3ABF9FEBC_m5B98F217DD400200A3A37CC64B292BFF0CC5C3E2P66AsyncTaskMethodBuilder_1_tC7B1E45031A96D1F2363C0491EC79BBE740BC10CP61U3CSendAsyncU3Ed__6_t6720512E6DD10EF0D901252321398CC3ABF9FEBCPK10MethodInfo (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instantiate:wasm-function[19708]:0x67b955)
_HttpRequestAdapter_SendAsync_mF4A96A9A6E697DD2CFBD0F43D3EB33E98E851969 (blob:http://oddsocksgame.com/67474cb4-6f5a-3c4c-9ec9-ce4b4961b6f0 line 1166 > WebAssembly.instanti
DaveOak commented 3 years ago

For anyone else with this issue, here is the solution. READ THE DOCUMENTATION!

Specifically, use UnityWebRequestAdapter.Instance when creating the Client on WebGL:

new Client("http", "nakama.oddsocksgame.com", 7350, "mykey", UnityWebRequestAdapter.Instance);