Cloud-CNC / cura-wasm

Cura Engine powered by Web Assembly (WASM)
https://cloud-cnc.github.io
Other
61 stars 17 forks source link

TypeError: Found invalid object in transferList #17

Closed marwan211 closed 1 year ago

marwan211 commented 1 year ago

im getting this error when running the example code in nodejs

Initialized worker!
Added definitions!
node:internal/worker:350
    ReflectApply(this[kPublicPort].postMessage, this[kPublicPort], args);
    ^

TypeError: Found invalid object in transferList
    at Worker.postMessage (node:internal/worker:350:5)
    at Object.run (C:\programming\3d api\node_modules\cura-wasm\dist\cjs.js:1:47957)
    at CuraWASM.slice (C:\programming\3d api\node_modules\cura-wasm\dist\cjs.js:1:4288512)
    at async main (C:\programming\3d api\src\i.js:26:31) {
  code: 'ERR_INVALID_TRANSFER_OBJECT'
}

and this is the code im running

const fs = require('fs');
const { CuraWASM } = require('cura-wasm');
const { resolveDefinition } = require('cura-wasm-definitions');

const main = async () => {
  const slicer = new CuraWASM({
    command: 'slice -j definitions/printer.def.json -o Model.gcode -s layer_height=0.06 -l Model.stl',
    definition: resolveDefinition('ultimaker2'),
    transfer: true,
    verbose: true
  });
  const stl = fs.readFileSync('./src/test.stl');
  const { gcode, metadata } = await slicer.slice(stl, 'stl');
console.log(metadata)
  slicer.dispose();
};
main();
Wakeful-Cloud commented 1 year ago

@marwan211 I apologize for not conveying this better, but I haven't worked on Cloud CNC in a few years and, as such, Cura WASM isn't maintained and you should probably avoid using the NPM package for security reasons (Alternatives below). I'm archiving this repository and all other Cloud CNC repositories, as well as deprecating all relevant NPM packages to prevent future confusion.

As for your issue, it's possible that whatever version of NodeJS you're using changed its structured cloning algorithm (Which is used to copy data to and from the worker) causing the error, though I'm not entirely sure how to fix it.


To anyone else reading this: we had a good run, but Cura WASM and Cloud CNC as a whole deserve more effort than I can realistically provide right now. Perhaps I'll find more time in the future, but until then, don't expect too much. If you need the functionality of Cura WASM, you have at least 4 alternatives:

$sha256$a6ab91893bbd50903679eb6f0d5364dba7ec12cd3ccc6b06dfb04c044e43d300