Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

TypeError: Found invalid object in transferList #17

Closed
marwan211 opened this issue Jun 14, 2023 · 1 comment
Closed

TypeError: Found invalid object in transferList #17

marwan211 opened this issue Jun 14, 2023 · 1 comment

Comments

@marwan211
Copy link

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
Copy link
Member

@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:

  • Use an existing fork or create your own
  • Use the somewhat untested WAPM version directly (Don't expect this to be updated either)
  • Upgrade the WAPM version to a newer version of Cura yourself (It really shouldn't take more than a 5-10 hours of work)
  • Invoke the Cura CLI bundled with Cura directly

$sha256$a6ab91893bbd50903679eb6f0d5364dba7ec12cd3ccc6b06dfb04c044e43d300

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants