node-oracle
node-oracle copied to clipboard
Assertion `handle->InternalFieldCount() > 0' failed
So, a co-worker had this problem when passing an object into execute
// shipment_id was returned from query and was assumed to be a string or int
// in actuality, shipment_id = { SHIPMENT_ID: '123' }
// shipment_id was thought to be '123', hence why we pass it to execute
// to be crystal clear, shipment_id is an object ( our bug that was entirely too difficult to debug )
connection.execute(query, [ shipment_id ] );
// Yields a hard crash in node-gyp
Assertion `handle->InternalFieldCount() > 0' failed
It is a very unhelpful error, as we thought we were passing a string. It crashes the c
code so there is no stack trace. Do all objects passed into args hard crash? If so, would it be possible to have a check to throw a javascript error that is more helpful?
It was on an update
if that helps narrow it down.
I have the same crash, but using prepared statement:
var sql = "INSERT INTO feed (message) VALUES (:1)";
var data = { message: "Some text message to insert"};
var stmt = oracleBinder.prepare(sql);
stmt.execute([data], function(err, count) { //error handle here });
Crash with the error message: node: /home/agora/.node-gyp/0.10.22/src/node_object_wrap.h:61: static T* node::ObjectWrap::Unwrap(v8::Handlev8::Object) [with T = OutParam]: Assertion `handle->InternalFieldCount() > 0' failed. Aborted
I have the same with @hmayer ;
How can I do with this problem?
Can you try
var sql = "INSERT INTO feed (message) VALUES (:1)";
var data = "Some text message to insert"; // NOT WRAPPED
var stmt = oracleBinder.prepare(sql);
stmt.execute([data], function(err, count) { //error handle here });
Yes, arguments checking is poor. It should not crash the process but return a nice JS exception instead.