You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It starts for me, but the /worker-version route crashes:
workerd/server/server.c++:2420: error: Uncaught exception: workerd/io/io-context.c++:1265: failed: remote.jsg.Error: The script will never generate a response.
stack: workerd@19186f0 workerd@19195d0 workerd@1919c00 workerd@2116be0 workerd@2119d10
This code will run, if you will provide wasm file generated through rust code.
By the way I am also facing one problem which is: the above code works but when you generate the wasm file through code written in golang, you need a wasm_exec.js file to the js code, and I am doing that as well, but the error I get is weird, don't know where I am wrong, see if you can help.
import'./wasm_exec.js';exportdefault{asyncfetch(req,env){try{constgo=newGo();constwasmBytes=awaitenv["main.wasm"].arrayBuffer();console.log("WASM bytes loaded, length:",wasmBytes.byteLength);const{ instance }=awaitWebAssembly.instantiate(wasmBytes,go.importObject);console.log("WASM instantiated successfully");go.run(instance);console.log("Go runtime started");constaddResult=instance.exports.add(1000,2);console.log("Add function called, result:",addResult);returnnewResponse(`Success: ${addResult}`);}catch(e){console.error("Error in worker:",e);returnnewResponse(`Error: ${e.message}`,{status: 500});}}}
Activity
meldron commentedon Jul 25, 2023
It starts for me, but the
/worker-versionroute crashes:SagarM21 commentedon Aug 27, 2024
@liweijian you need to provide the js code to workerd binary to run the wasm file, like this
This code will run, if you will provide wasm file generated through rust code.
By the way I am also facing one problem which is: the above code works but when you generate the wasm file through code written in golang, you need a wasm_exec.js file to the js code, and I am doing that as well, but the error I get is weird, don't know where I am wrong, see if you can help.
CAPNP file:
Exact error I am getting: