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.

UnhandledPromiseRejectionWarning in IMAP handler

See original GitHub issue

Hi,

I randomly get this error when the connection has been open for about one to six hours (outlook.office.com IMAP server). It does trigger client.onerror but can’t be caught by a catch on the client’s methods.

Running on heroku with node ^10.

Haven’t been able to reproduce it at will (it just happens on its own after some time, at which point I create a new client and reconnect and it works fine until it happens again, etc).

(node:20) UnhandledPromiseRejectionWarning: Error: Unexpected char at position 18
    at ParserInstance.getElement (/app/node_modules/emailjs-imap-handler/dist/parser.js:152:17)
    at ParserInstance.getCommand (/app/node_modules/emailjs-imap-handler/dist/parser.js:112:29)
    at exports.default (/app/node_modules/emailjs-imap-handler/dist/parser.js:17:29)
    at Imap._parseIncomingCommands (/app/node_modules/emailjs-imap-client/dist/imap.js:577:51)
    at Imap._onData (/app/node_modules/emailjs-imap-client/dist/imap.js:428:10)
    at TCPSocket.socket.ondata.evt (/app/node_modules/emailjs-imap-client/dist/imap.js:160:16)
    at TCPSocket._emit (/app/node_modules/emailjs-tcp-socket/dist/node-socket.js:103:31)
    at TLSSocket.<anonymous> (/app/node_modules/emailjs-tcp-socket/dist/node-socket.js:69:23)
    at TLSSocket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:283:12)

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
SunriseFoxcommented, Sep 27, 2018

Yet another kind of uncaught error popped up while the IMAP client was idling:

UnhandledPromiseRejectionWarning: Error:  Socket timed out! 
    at Timeout._socketTimeoutTimer.setTimeout (/app/node_modules/emailjs-imap-client/dist/imap.js:365:63) 
    at ontimeout (timers.js:425:11) 
    at tryOnTimeout (timers.js:289:5) 
    at listOnTimeout (timers.js:252:5) 
    at Timer.processTimers (timers.js:212:10) 

It’s not entirely surprising that some network errors may occur after hours of keeping a connection alive, and it’s easy enough to reconnect. The only problem I have here is the uncaught bit. Someday this will make Node.js just crash.

See #195 … I think it is the problem.

0reactions
cormipcommented, Dec 17, 2018

Also seeing the UnhandledPromiseRejectionWarning: Error: Unexpected char at position 18 error. It’s definitely occuring while the IMAP client is simply idling (not retrieving a message). The host I’m connected to is imap-mail.outlook.com:

2018-12-14 01:16:55-05:00(node:7) UnhandledPromiseRejectionWarning: Error: Unexpected char at position 18
2018-12-14 01:16:55-05:00 at ParserInstance.getElement (/app/bundle/programs/server/npm/node_modules/emailjs-imap-handler/dist/parser.js:152:17)
2018-12-14 01:16:55-05:00 at ParserInstance.getCommand (/app/bundle/programs/server/npm/node_modules/emailjs-imap-handler/dist/parser.js:112:29)
2018-12-14 01:16:55-05:00 at exports.default (/app/bundle/programs/server/npm/node_modules/emailjs-imap-handler/dist/parser.js:17:29)
2018-12-14 01:16:55-05:00 at Imap._parseIncomingCommands (/app/bundle/programs/server/npm/node_modules/emailjs-imap-client/dist/imap.js:577:51)
2018-12-14 01:16:55-05:00 at Imap._onData (/app/bundle/programs/server/npm/node_modules/emailjs-imap-client/dist/imap.js:428:10)
2018-12-14 01:16:55-05:00 at TCPSocket.socket.ondata.evt (/app/bundle/programs/server/npm/node_modules/emailjs-imap-client/dist/imap.js:160:16)
2018-12-14 01:16:55-05:00 at TCPSocket._emit (/app/bundle/programs/server/npm/node_modules/emailjs-tcp-socket/dist/node-socket.js:103:31)
2018-12-14 01:16:55-05:00 at TLSSocket.<anonymous> (/app/bundle/programs/server/npm/node_modules/emailjs-tcp-socket/dist/node-socket.js:69:23)
2018-12-14 01:16:55-05:00 at emitOne (events.js:116:13)
2018-12-14 01:16:55-05:00 at TLSSocket.emit (events.js:211:7)
2018-12-14 01:16:55-05:00 at addChunk (_stream_readable.js:263:12)
2018-12-14 01:16:55-05:00 at readableAddChunk (_stream_readable.js:250:11)
2018-12-14 01:16:55-05:00 at TLSSocket.Readable.push (_stream_readable.js:208:10)
2018-12-14 01:16:55-05:00 at TLSWrap.onread (net.js:597:20)
2018-12-14 01:16:55-05:00(node:7) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 158)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodejs imap-simple UnhandledPromiseRejectionWarning issue
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >
Developers - UnhandledPromiseRejectionWarning in IMAP handler -
Hi,. I randomly get this error when the connection has been open for about one to six hours (outlook.office.com IMAP server). It does...
Read more >
I am getting this error . UnhandledPromiseRejectionWarning
After adding try catch block getting "Error: No refresh token or refresh handler callback is set." this error. Any way to make it...
Read more >
How to Resolve Certificate Errors in a NodeJS App with SSL ...
These errors originate from the SSL handshake process. When a client begins to establish a connection to the server, a TLS handshake happens....
Read more >
Unhandled Promise Rejections in Node.js - The Code Barbarian
Note that if you attach a listener to 'unhandledRejection', the default warning to the console (the UnhandledPromiseRejectionWarning from ...
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