You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ node -r esm t.js
/home/warner/stuff/agoric/agoric-sdk/node_modules/bindings/bindings.js:1
TypeError: Cannot read property 'indexOf' of undefined
at Function.getFileName (/home/warner/stuff/agoric/agoric-sdk/node_modules/bindings/bindings.js:178:16)
at bindings (/home/warner/stuff/agoric/agoric-sdk/node_modules/bindings/bindings.js:82:48)
at Object.<anonymous> (/home/warner/stuff/agoric/agoric-sdk/node_modules/node-lmdb/index.js:3:37)
at Generator.next (<anonymous>)
at Object.<anonymous> (/home/warner/stuff/agoric/agoric-sdk/packages/swing-store-lmdb/t.js:1)
at Generator.next (<anonymous>)
The core problem seems to be the bindings module used by node-lmdb, which modifies Error to learn the filename of the invoking module (and leverage that to find the DLL/.so that needs to be imported):
exports.getFileName=functiongetFileName(calling_file){varorigPST=Error.prepareStackTrace,origSTL=Error.stackTraceLimit,dummy={},fileName;Error.stackTraceLimit=10;Error.prepareStackTrace=function(e,st){for(vari=0,l=st.length;i<l;i++){fileName=st[i].getFileName();if(fileName!==__filename){if(calling_file){if(fileName!==calling_file){return;}}else{return;}}}};// run the 'prepareStackTrace' function aboveError.captureStackTrace(dummy);dummy.stack;// cleanupError.prepareStackTrace=origPST;Error.stackTraceLimit=origSTL;// handle filename that starts with "file://"varfileSchema='file://';if(fileName.indexOf(fileSchema)===0){fileName=fileURLToPath(fileName);}returnfileName;};
The error is due to fileName being undefined, probably because prepareStackTrace was not successfully overridden. Calling lockdown() with noTameError: true doesn't help.
The text was updated successfully, but these errors were encountered:
For LMDB, one workaround is to import 'node-lmdb' (for side-effects only, no imported names) before install-ses, then let the normal code import it again afterwards. It looks like the DLL is located (and maybe loaded) the first time it gets imported. This still falls into the "vetted shim" category, but it's at least a functional workaround.
warner
added a commit
to Agoric/agoric-sdk
that referenced
this issue
May 28, 2020
When
install-ses.js
is a file that imports SES-0.7.7 and callslockdown()
, the following program:fails like:
The core problem seems to be the
bindings
module used bynode-lmdb
, which modifiesError
to learn the filename of the invoking module (and leverage that to find the DLL/.so that needs to be imported):The error is due to
fileName
being undefined, probably becauseprepareStackTrace
was not successfully overridden. Callinglockdown()
withnoTameError: true
doesn't help.The text was updated successfully, but these errors were encountered: