I wanted something more efficient for verifying password hashes so i tried using bcrypt wasm and argon2 wasm, but both give this error:
Uncaught TypeError: WebAssembly Instantiation: Import #0 module="env" error: module is not an object or function
I’ve of course added them to wasm resources and verified with another wasm that wasm actually works, but neither of these work:
hixus
June 23, 2019, 8:42am
2
Did you get it working on different platform or with another wasm in Cloudflare? I have the same issue.
Sorry to say, but only hashing algos that require little CPU-time work on Cloudflare workers due to the limits on it.
In other words, bcrypt and argo2 don’t work.
skldn
January 17, 2020, 10:56am
4
I too have this issue and I don’t understand why. My wasm file just emits 9kb u8[]
so nothing CPU based and yet I have this same error, unsure how to proceed.
thomas4
January 17, 2020, 11:03am
5
Maybe there’s a loop in the wasm? It might give the same result as cpu running out.
1 Like
skldn
January 17, 2020, 11:25am
6
nvm I solved it, I’m using AssemblyScript and it requries a boilerplate “env” function on the imports I didn’t realise this and now it works.
const imports = {
env: {
abort(_msg, _file, line, column) {
console.error("abort called at index.ts:" + line + ":" + column);
}
}
};
const instance = new WebAssembly.Instance(/* WASM NAME */, imports).exports;
instance.doSomething();
1 Like
thomas4
January 17, 2020, 11:26am
7
Thanks for sharing the solution to the problem
1 Like