Loading WASM (C++/Emscripten) from a Javascript Worker

For Workes & Pages, what is the name of the domain?

wasm-hello-world._.workers.dev

What is the issue or error you’re encountering

https://wasm-hello-world._.workers.dev/

What steps have you taken to resolve the issue?

I’m able to call a function from a WASM generated by Emscripten inside a Worker.
I’m using an approach almost like the one implemented here: cf-workers-emscripten/index.js at main · robertaboukhalil/cf-workers-emscripten · GitHub in this approach each time “fetch” is called the WebAssembly module is loaded.

I was trying to instantiate the WebAssembly module once and share it with several “fetch” executions like what’s implemented here: worker-emscripten-template/index.js at master · cloudflare/worker-emscripten-template · GitHub but I get an error because Promisses are not supported outside an handler:
“Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. Handlers | Cloudflare Workers docs”.

What is current recommended approach to load a WASM generated from C++ with Emscripten and have it loaded just once (not in every request)?

What are the steps to reproduce the issue?

Follow GitHub - cloudflare/worker-emscripten-template