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
When we try to use the oso library from an nodejs AWS lambda (using Serverless Framework) we get a problem with the path to the file polar_wasm_api_bg.wasm. In your library code the path to the polar_wasm_api_bg.wasm file is hardcoded to __dirname (see code snippet below). When the lambda executes this means the same dir as the lambda source and it means that we have to copy this wasm files to all source folders containing lambdas using oso, because of the way lambdas are built and executed. It would be very good if you for example by an optional environment variable or similar could have a bit more flexible way of telling the path to the wasm file. Or maybe there is an even better more standardized way of doing this wasm import in the code.
From your nodejs module node_modules/oso/dist/src/polar_wasm_api.js:
When we try to use the oso library from an nodejs AWS lambda (using Serverless Framework) we get a problem with the path to the file polar_wasm_api_bg.wasm. In your library code the path to the polar_wasm_api_bg.wasm file is hardcoded to __dirname (see code snippet below). When the lambda executes this means the same dir as the lambda source and it means that we have to copy this wasm files to all source folders containing lambdas using oso, because of the way lambdas are built and executed. It would be very good if you for example by an optional environment variable or similar could have a bit more flexible way of telling the path to the wasm file. Or maybe there is an even better more standardized way of doing this wasm import in the code.
From your nodejs module node_modules/oso/dist/src/polar_wasm_api.js:
...
const path = require('path').join(__dirname, 'polar_wasm_api_bg.wasm');
const bytes = require('fs').readFileSync(path);
const wasmModule = new WebAssembly.Module(bytes);
const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
wasm = wasmInstance.exports;
module.exports.__wasm = wasm;
...
The text was updated successfully, but these errors were encountered: