download icon indicating copy to clipboard operation
download copied to clipboard

500 errors from "got" module print randomly to console

Open GeoffreyPlitt opened this issue 6 years ago • 1 comments

We're using "download" in our server, and seeing these errors randomly printed to the console, even when we get a successful download:

Dec 05 20:20:17 stardust-backend app/web.1:  ERROR: HTTPError: Response code 500 (Internal Server Error) 
Dec 05 20:20:17 stardust-backend app/web.1:      at EventEmitter.ee.on.res (/app/node_modules/got/index.js:250:24) 
Dec 05 20:20:17 stardust-backend app/web.1:      at EventEmitter.emit (events.js:159:13) 
Dec 05 20:20:17 stardust-backend app/web.1:      at Immediate.setImmediate (/app/node_modules/got/index.js:99:8) 
Dec 05 20:20:17 stardust-backend app/web.1:      at runCallback (timers.js:800:20) 
Dec 05 20:20:17 stardust-backend app/web.1:      at tryOnImmediate (timers.js:762:5) 
Dec 05 20:20:17 stardust-backend app/web.1:      at processImmediate [as _immediateCallback] (timers.js:733:5) 
Dec 05 20:20:17 stardust-backend app/web.1:  HTTPError: Response code 500 (Internal Server Error) 

Notice that none of the stack in this error report is my code, it's all in node_modules, so it's an out-of-band error that doesn't propagate properly into promise/reject as expected.

It comes from module "got" which is not used by anything else in our project except "download". Are all errors from "got" being trapped/handled correctly? How do I get rid of these console logs, or turn them into proper promise-reject errors that fit our promise chain error handling properly?

GeoffreyPlitt avatar Dec 06 '17 19:12 GeoffreyPlitt

@kevva thoughts?

GeoffreyPlitt avatar Dec 22 '17 01:12 GeoffreyPlitt