RuntimeError: abort(Error: <Insert my error here>). Build with -s ASSERTIONS=1 for more info.
See original GitHub issueHi!
EDIT: I’ve created a repo with a minimal example of the bug, for people to try out and confirm: https://github.com/iAmMichaelConnor/solc-error-demo
solc version: 0.7.1 (& tested with 0.7.4) node version: 12.18.2 (& tested with latest lts v15.0.1)
I’m writing a node.js application which imports solc-js in one .mjs
file to compile a solidity file and output the AST.
During development, whenever my application breaks and throws an error, the console spits out a solc-related error. Strangely, the solc-related error will throw even for code that isn’t using solc. It appears the file ./node_modules/solc/soljson.js
is somehow ‘wrapping’ my error messages.
A consequence of this is that every time my application throws an error, the console is filled with the thousands of lines of code contained in the file ./node_modules/solc/soljson.js
.
Below is an example console output upon my app erroring. (Notice that the actual error is unrelated to solc; I’m accidentally push
ing to undefined
elsewhere in my app. In fact, at this stage of my app’s code, solc has been long finished with, and will not be called upon again).
Error: TypeError: Cannot read property 'push' of undefined
Error: TypeError: Cannot read property 'push' of undefined
/Users/em137vl/Documents/git/sprinkles/node_modules/solc/soljson.js:1
null;var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var arguments_=[];var thisProgram="./this.program";var quit_=function(status,toThrow){throw toThrow};var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;
// I'VE OMITTED THE THOUSANDS OF LINES FROM THE MIDDLE OF `./node_modules/solc/soljson.js`
ledRun=true;Module["calledRun"]=true;if(ABORT)return;initRuntime();preMain();if(Module["onRuntimeInitialized"])Module["onRuntimeInitialized"]();postRun()}if(Module["setStatus"]){Module["setStatus"]("Running...");setTimeout(function(){setTimeout(function(){Module["setStatus"]("")},1);doRun()},1)}else{doRun()}}Module["run"]=run;function exit(status,implicit){if(implicit&&noExitRuntime&&status===0){return}if(noExitRuntime){}else{ABORT=true;EXITSTATUS=status;exitRuntime();if(Module["onExit"])Module["onExit"](status)}quit_(status,new ExitStatus(status))}if(Module["preInit"]){if(typeof Module["preInit"]=="function")Module["preInit"]=[Module["preInit"]];while(Module["preInit"].length>0){Module["preInit"].pop()()}}noExitRuntime=true;run();
RuntimeError: abort(Error: TypeError: Cannot read property 'push' of undefined). Build with -s ASSERTIONS=1 for more info.
at process.abort (~/git/my-project/node_modules/solc/soljson.js:1:13938)
at process.emit (events.js:315:20)
at processEmit [as emit] (~/git/my-project/node_modules/signal-exit/index.js:161:32)
at processPromiseRejections (internal/process/promises.js:209:33)
at processTicksAndRejections (internal/process/task_queues.js:98:32)
Any ideas to stop solc wrapping errors?
Many thanks!
Issue Analytics
- State:
- Created 3 years ago
- Reactions:6
- Comments:7 (3 by maintainers)
Hi @iAmMichaelConnor, @yilmazbingo, and @TimDaub,
I looked at this problem, and apparently, it was fixed on version
>=0.8.12
. I tested the demo using the recent solcjs versions, and it worked as expected. However, for older binaries (<0.8.12), you may need to use the workaround suggested here: https://github.com/ethereum/solidity/issues/12228 to remove the listener of unhandled Promise rejections.I.e. adding the following to your code (you can test it with your demo):
For me, I also tend to run into these problems regularly and the problem is that before, in node.js, it seems something is dumping loads of data into my shell. Can this at least be prevented somehow? It makes debugging any earlier code quite tricky…
https://user-images.githubusercontent.com/2758453/164273596-12c66ed2-ab98-4f9e-bbea-c4aed211058e.mov