duckdb-node icon indicating copy to clipboard operation
duckdb-node copied to clipboard

when i new evidence project , it shows node FATAL ERROR: v8::Template::Set Invalid value, must be a primitive or a Template ----- Native stack trace -----

Open taste1989 opened this issue 1 year ago • 8 comments

hi I report this issue https://github.com/evidence-dev/evidence/issues/2146 in evidence. archiewood told me to report here.

taste1989 avatar Jun 25 '24 09:06 taste1989

node test.js FATAL ERROR: v8::Template::Set Invalid value, must be a primitive or a Template ----- Native stack trace -----

1: 0x104d88b18 node::OnFatalError(char const*, char const*) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 2: 0x104f13a2c v8::Template::Set(v8::Localv8::Name, v8::Localv8::Data, v8::PropertyAttribute) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 3: 0x104d3a460 napi_define_class [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 4: 0x11a8c9408 Napi::ObjectWrap<node_duckdb::Database>::DefineClass(Napi::Env, char const*, unsigned long, napi_property_descriptor const*, void*) [/Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/binding/duckdb.node] 5: 0x11a8c59ac node_duckdb::Database::Init(Napi::Env, Napi::Object) [/Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/binding/duckdb.node] 6: 0x11a8c3938 NodeDuckDB::NodeDuckDB(Napi::Env, Napi::Object) [/Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/binding/duckdb.node] 7: 0x11a8c52e8 Napi::Addon::Init(Napi::Env, Napi::Object) [/Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/binding/duckdb.node] 8: 0x11a8c4980 napi_register_module_v1 [/Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/binding/duckdb.node] 9: 0x104d53030 napi_module_register_by_symbol(v8::Localv8::Object, v8::Localv8::Value, v8::Localv8::Context, napi_value__* ()(napi_env__, napi_value__), int) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 10: 0x104d5854c std::__1::__function::__func<node::binding::DLOpen(v8::FunctionCallbackInfov8::Value const&)::$_0, std::__1::allocator<node::binding::DLOpen(v8::FunctionCallbackInfov8::Value const&)::$_0>, bool (node::binding::DLib)>::operator()(node::binding::DLib*&&) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 11: 0x104d278e4 node::Environment::TryLoadAddon(char const*, int, std::__1::function<bool (node::binding::DLib*)> const&) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 12: 0x104d571c4 node::binding::DLOpen(v8::FunctionCallbackInfov8::Value const&) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 13: 0x104f7e2f0 v8::internal::MaybeHandlev8::internal::Object v8::internal::(anonymous namespace)::HandleApiCallHelper(v8::internal::Isolate*, v8::internal::Handlev8::internal::HeapObject, v8::internal::Handlev8::internal::FunctionTemplateInfo, v8::internal::Handlev8::internal::Object, unsigned long*, int) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 14: 0x104f7d9e8 v8::internal::Builtin_HandleApiCall(int, unsigned long*, v8::internal::Isolate*) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 15: 0x105804b24 Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 16: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 17: 0x10a8dd484 18: 0x10a8dbf58 19: 0x10a8d4328 20: 0x10a8d237c 21: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 22: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 23: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 24: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 25: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 26: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 27: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 28: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 29: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 30: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 31: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 32: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 33: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 34: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 35: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 36: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 37: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 38: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 39: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 40: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 41: 0x10577c3e4 Builtins_InterpreterEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 42: 0x10577a50c Builtins_JSEntryTrampoline [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 43: 0x10577a1f4 Builtins_JSEntry [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 44: 0x1050522f0 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 45: 0x10505173c v8::internal::Execution::Call(v8::internal::Isolate*, v8::internal::Handlev8::internal::Object, v8::internal::Handlev8::internal::Object, int, v8::internal::Handlev8::internal::Object) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 46: 0x104f2c02c v8::Function::Call(v8::Localv8::Context, v8::Localv8::Value, int, v8::Localv8::Value) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 47: 0x104d69c28 node::builtins::BuiltinLoader::CompileAndCall(v8::Localv8::Context, char const*, node::Realm*) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 48: 0x104df8cf8 node::Realm::ExecuteBootstrapper(char const*) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 49: 0x104d4d69c node::StartExecution(node::Environment*, std::__1::function<v8::MaybeLocalv8::Value (node::StartExecutionCallbackInfo const&)>) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 50: 0x104cb9504 node::LoadEnvironment(node::Environment*, std::__1::function<v8::MaybeLocalv8::Value (node::StartExecutionCallbackInfo const&)>, std::__1::function<void (node::Environment*, v8::Localv8::Value, v8::Localv8::Value)>) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 51: 0x104dc886c node::NodeMainInstance::Run(node::ExitCode*, node::Environment*) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 52: 0x104dc85dc node::NodeMainInstance::Run() [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 53: 0x104d507f4 node::Start(int, char**) [/Users/yi/.nvm/versions/node/v20.15.0/bin/node] 54: 0x198299430 start [/usr/lib/system/libdyld.dylib]

----- JavaScript stack trace -----

1: Module._extensions..node (node:internal/modules/cjs/loader:1454:18) 2: Module.load (node:internal/modules/cjs/loader:1208:32) 3: Module._load (node:internal/modules/cjs/loader:1024:12) 4: Module.require (node:internal/modules/cjs/loader:1233:19) 5: require (node:internal/modules/helpers:179:18) 6: /Users/yi/Documents/Evidence/test-duckdb/node_modules/duckdb/lib/duckdb-binding.js:4:15 7: Module._compile (node:internal/modules/cjs/loader:1358:14) 8: Module._extensions..js (node:internal/modules/cjs/loader:1416:10) 9: Module.load (node:internal/modules/cjs/loader:1208:32) 10: Module._load (node:internal/modules/cjs/loader:1024:12)

zsh: abort node test.js

taste1989 avatar Jun 25 '24 09:06 taste1989

Could you try again, with the same workflow as https://github.com/evidence-dev/evidence/issues/2146#issuecomment-2187830361, but with two twists:

npm uninstall duckdb
npm install duckdb --verbose

(and copy pasting the log, that for me looks like:

npm verb cli /opt/homebrew/Cellar/node/21.7.3/bin/node /opt/homebrew/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verb title npm install duckdb
npm verb argv "install" "duckdb" "--loglevel" "verbose"
...
....
npm info run [email protected] install node_modules/duckdb node-pre-gyp install --fallback-to-build
npm info run [email protected] install { code: 0, signal: null }

added 111 packages, and audited 112 packages in 2s

6 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
npm verb exit 0
npm info ok 

And then going further with the other steps.

Otherwise:

npm uninstall duckdb
npm install duckdb --verbose --build-from-source

(this will take a while)

carlopi avatar Jun 25 '24 09:06 carlopi

hi @carlopi in vscode, it's still show errors as follow log.txt

taste1989 avatar Jun 25 '24 11:06 taste1989

Hey, thanks for reporting, will have another look.

hannes avatar Jul 08 '24 09:07 hannes

I had the same issue that @taste1989 was reporting except that I was running on an intel mac (don't ask,lol) . Noticed that npm uninstall duckdb does not delete duckdb and duckdb-async dirs from node_modules. Went ahead and manually deleted folders. Installed from source as noted above. That took care of the issue.

arungk avatar Jul 10 '24 21:07 arungk

@taste1989 / @arungk : I am having a hard time reproducing this, which VSCode versions are you at? Or even better, can you reproduce outside of VSCode?

I have found this VSCode issue: https://github.com/microsoft/vscode/issues/219893 that might be somehow related, although I can't understand how the workaround would solve it here.

carlopi avatar Jul 29 '24 10:07 carlopi

@archiewood: sorry for spamming, but I am not super comfortable with this issue, and was wondering if you could take another look.

Basically what I am observing is that however a module is (badly) built, it should not allow node to throw FATAL_ERROR, so I am thinking this is likely a problem on tooling that looks to be out of our (duckdb) control.

If you have any feedback or suggested line of action, it would be very welcome. Thanks

carlopi avatar Jul 29 '24 12:07 carlopi

Hey @carlopi - why is VSCode relevant here? is this not all happening from the command line?

@taste1989 can you clarify what you mean by "in vscode"

archiewood avatar Jul 30 '24 02:07 archiewood