Uncaught (in promise) TypeError: handle is undefined

13 views
Skip to first unread message

キャロウ マーク

unread,
May 24, 2025, 6:03:29 AMMay 24
to emscripten-discuss Sam Clegg via
After fixing the raw pointer issue I asked about in another thread, a new problem has cropped up. Whenever my app tries to call a native function on the created module I get the subject error.

Here is a typical stack trace

Uncaught (in promise) TypeError: handle is undefined
    __emval_get_property http://192.168.50.139:8080/libktx.js:7
    anonymous http://192.168.50.139:8080/libktx.js line 7 > Function:9

I am using -sMODULARIZE and I instantiate the module with

  createKtxModule({preinitializedWebGLContext: gl}).then(instance => {
    window.ktx = instance;
    // Make existing WebGL context current for Emscripten OpenGL.
    ktx.GL.makeContextCurrent(
                ktx.GL.createContext(document.getElementById("glcanvas"),
                                        { majorVersion: 2.0 })
                );
    main()
  });

where createKtxModule is the export name. That call to ktx.GL.makeContextCurrent is working but I suppose that is not a native function.

Everything was working on 4.0.7.

I read https://emscripten.org/docs/compiling/Modularized-Output.html but can’t see any change required when continuing to use -sMODULARIZE.

Does anyone know how to fix this?

I am horrified by the number of breakages these supposedly minor patch releases (4.0.8 and 4.0.9) have caused in my code. I have spent 2 days on fixes so far.
signature.asc

キャロウ マーク

unread,
May 24, 2025, 8:40:52 AMMay 24
to emscripte...@googlegroups.com
I figured this one out too. I built a debug version and at run time a message appeared in the console telling me I need to add HEAP8 to EXPORTED_RUNTIME_METHODS. After doing that my apps work except for one test which is failing and which I will investigate now..

Regards

    -Mark

--
You received this message because you are subscribed to the Google Groups "emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-disc...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/emscripten-discuss/AEC5B023-EDF3-48E3-9F5F-70B9C6C454DB%40callow.im.

signature.asc
Reply all
Reply to author
Forward
0 new messages