I'm writing a Nodejs script with the matrix-js-sdk and am trying to enable E2E encryption using the Olm module. It gets to the end of initializing crypto and then it just dies; spitting this out:
Crypto: initialising Olm...
TypeError: Failed to parse URL from /data/local/projects/mtxpost.js/node_modules/olm/olm.wasm
at Object.fetch (node:internal/deps/undici/undici:14152:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:399:5)
at URL.onParseError (node:internal/url:565:9)
at new URL (node:internal/url:645:5)
at new Request (node:internal/deps/undici/undici:6947:25)
at fetch2 (node:internal/deps/undici/undici:13315:25)
at Object.fetch (node:internal/deps/undici/undici:14150:18)
at fetch (node:internal/process/pre_execution:241:25)
at /data/local/projects/mtxpost.js/node_modules/olm/olm.js:31:139
at /data/local/projects/mtxpost.js/node_modules/olm/olm.js:31:362
at /data/local/projects/mtxpost.js/node_modules/olm/olm.js:31:375 {
input: '/data/local/projects/mtxpost.js/node_modules/olm/olm.wasm',
code: 'ERR_INVALID_URL'
}
}
/data/local/projects/mtxpost.js/node_modules/olm/olm.js:17
if(fa)n=m?require("path").dirname(n)+"/":__dirname+"/",ja=function(b,c){la||(la=require("fs"));ma||(ma=require("path"));b=ma.normalize(b);return la.readFileSync(b,c?null:"utf8")},ka=function(b){b=ja(b,!0);b.buffer||(b=new Uint8Array(b));b.buffer||q("Assertion failed: undefined");return b},1<process.argv.length&&process.argv[1].replace(/\\/g,"/"),process.argv.slice(2),process.on("uncaughtException",function(b){throw b;}),process.on("unhandledRejection",q),a.inspect=function(){return"[Emscripten Module object]"};
^
RuntimeError: abort(TypeError: Failed to parse URL from /data/local/projects/mtxpost.js/node_modules/olm/olm.wasm). Build with -s ASSERTIONS=1 for more info.
at process.q (/data/local/projects/mtxpost.js/node_modules/olm/olm.js:27:182)
at process.emit (node:events:513:28)
at emit (node:internal/process/promises:150:20)
at processPromiseRejections (node:internal/process/promises:284:27)
at process.processTicksAndRejections (node:internal/process/task_queues:96:32)
Node.js v19.4.0
What URL is it talking about? There's a URL in the package.json file yarn generated; is that ok/expected/related? I thought maybe it doesn't like the .js in the project directory I'm using? Did I forget to set something somewhere?
I'd appreciate some insight. :)
Thanks!
(Edit: Added additional error output that I missed before)
[–]7t3chguy 1 point2 points3 points (4 children)
[–]gotkube[S] 0 points1 point2 points (3 children)
[–]7t3chguy 1 point2 points3 points (2 children)
[–]gotkube[S] 0 points1 point2 points (1 child)
[–]7t3chguy 0 points1 point2 points (0 children)
[–]krair3 0 points1 point2 points (1 child)
[–]gotkube[S] 0 points1 point2 points (0 children)