const isolate = new ivm.Isolate({ memoryLimit: 128 });
const context = isolate.createContextSync();
const ctxGlobal = context.global;
ctxGlobal.setSync('global', ctxGlobal.derefInto());
ctxGlobal.setSync('fetch', async function (...args) {
// do somethings
});
const result = context.evalSync("(async ()=>{ await fetch(); })()");
return result;
However, I encountered an error "TypeError: # could not be cloned." I attempted to create an isolated environment using the ivm module and run asynchronous code within it, but it seems to be causing an issue.
Could someone please explain how this error is occurring? What steps should I take to resolve it?
Hello fellow developers,
I've tried the following code:
However, I encountered an error "TypeError: # could not be cloned." I attempted to create an isolated environment using the ivm module and run asynchronous code within it, but it seems to be causing an issue.
Could someone please explain how this error is occurring? What steps should I take to resolve it?
Thank you very much for your assistance!