UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'unref' of undefined
See original GitHub issueI’m getting this error in node.js during the cleanup while the program is shutting down. I can narrow down the problem to these two lines of code:
https://github.com/feross/simple-peer/blob/master/index.js#L876
self._interval = setInterval(function () { self._onInterval() }, 150)
if (self._interval.unref) self._interval.unref()
It seems that in Node the return value of setInterval
can sometimes be undefined, perhaps during some post-event-loop cleanup or something like that. I think the second line here should be changed to
if (self._interval && self._interval.unref) self._interval.unref()
Issue Analytics
- State:
- Created 4 years ago
- Comments:7
Top Results From Across the Web
UnhandledPromiseRejectionWar...
(node:5088) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'close' of undefined at Object.<anonymous> (C:\Users\Olakunle-PC\ ...
Read more >Resolving the JavaScript Promise Error "TypeError: Cannot ...
TypeError - Cannot read property 'then' of undefined is thrown when the caller is expecting a Promise to be returned and instead receives ......
Read more >TypeError: Cannot read property 'data' of undefined
to show where the warning was created) [0] (node:24430) UnhandledPromiseRejectionWarning: Unhandled promise rejection.
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >TypeError: Cannot read property 'startsWith' of undefined
TypeError : Cannot read property 'startsWith' of undefined: D:\codespace\zzz\node_modules\mongodb-connection-string-url\lib\index.js:9 return ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I opened issue https://github.com/jsdom/jsdom/issues/2617
Can you report to jsdom developers that this is wrong and breaks applications, please?