question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

RuntimeError: abort(Error: <Insert my error here>). Build with -s ASSERTIONS=1 for more info.

See original GitHub issue

Hi!

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 pushing 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:open
  • Created 3 years ago
  • Reactions:6
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
r0qscommented, Sep 26, 2022

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):

const listeners = process.listeners("unhandledRejection");
process.removeListener("unhandledRejection", listeners[listeners.length - 1]);
0reactions
TimDaubcommented, Apr 20, 2022

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

abort([object Object]). Build with -s ASSERTIONS=1 for more ...
I wrote the deploy() in try/catch block: const deploy = async () => { try { const accounts = await web3.eth.
Read more >
RuntimeError: abort(OOM). Build with -s ASSERTIONS=1 for ...
I get this error running an overlay ffmpeg command in the browser, slapping an png over an hevc mp4 4K video of size,...
Read more >
I get this error on Firefox 90.0.2 on Debian 10. It works in chrome ...
I get this error on Firefox 90.0.2 on Debian 10. ... [error: RuntimeError: abort(Error: Couldn't load ... Build with -s ASSERTIONS=1 for more...
Read more >
Fix JavaScript errors that are reported in the Console
In this article. Fix JavaScript errors; Find and debug network issues; Create errors and traces in the Console; See also.
Read more >
Python Exceptions: An Introduction - Real Python
After that, you will learn about raising exceptions and making assertions. ... Instead of showing the message exception error , Python details what...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found