abbr / deasync

Turns async function into sync via JavaScript wrapper of Node event loop
MIT License
971 stars 73 forks source link

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal. #168

Open skerit opened 2 years ago

skerit commented 2 years ago

I'm getting this error:

FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal.
 1: 0xb09980 node::Abort() [node]
 2: 0xa1c235 node::FatalError(char const*, char const*) [node]
 3: 0xcf758a v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: 0xa8b12d node::Environment::CheckImmediate(uv_check_s*) [node]
 5: 0x156b619  [node]
 6: 0x1563d28 uv_run [node]
 7: 0x7f5a4c0eebad Run(Napi::CallbackInfo const&) [/mnt/pom/alchemy/core/node_modules/deasync/bin/linux-x64-node-16/deasync.node]
 8: 0x7f5a4c0efd83 Napi::details::CallbackData<Napi::Value (*)(Napi::CallbackInfo const&), Napi::Value>::Wrapper(napi_env__*, napi_callback_info__*) [/mnt/pom/alchemy/core/node_modules/deasync/bin/linux-x64-node-16/deasync.node]
 9: 0xab44dd  [node]
10: 0xd53d8e  [node]
11: 0xd551af v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [node]
12: 0x15f0bf9  [node]
fish: 'node server.js --disable-janeway' terminated by signal SIGABRT (Abort)
skerit commented 2 years ago

I basically wanted to make an annoying ESM-only module synchronous:

var done = false;
var data;

let _module = import('franc');

_module.then(result => {
    data = result;
    done = true;
}).catch(err => {
    done = true;
})

require('deasync').loopWhile(function(){return !done;});
kirrg001 commented 7 months ago

I am having the same problem with Node 20 and Node 21.