Cannot read property 'bodyEmitter' of undefined
Opened this issue · 0 comments
I've been having some issues the listener, where it sometimes gets disconnected.
I've put up a retry mechanism, where upon 'server:disconnected' it retries to connect (.start() command) every 1 minute, but then I see the logs stacked with the following error (seems intermittent):
info: IMAP disconnected, retrying...
info: Restarting IMAP connection. [retries=1]
info: Restarting IMAP connection. [retries=2]
info: Restarting IMAP connection. [retries=3]
info: Restarting IMAP connection. [retries=4]
error: uncaughtException: Cannot read property 'bodyEmitter' of undefined
stack:
[ 'TypeError: Cannot read property 'bodyEmitter' of undefined',
' at Connection._resTagged (../node_modules/mail-listener2/node_modules/imap/lib/Connection.js:1484:10)',
' at Parser. (../node_modules/mail-listener2/node_modules/imap/lib/Connection.js:177:10)',
' at Parser.EventEmitter.emit (events.js:95:17)',
' at Parser._resTagged (../node_modules/mail-listener2/node_modules/imap/lib/Parser.js:175:10)',
' at Parser._parse (../node_modules/mail-listener2/node_modules/imap/lib/Parser.js:139:16)',
' at Parser._tryread (../node_modules/mail-listener2/node_modules/imap/lib/Parser.js:82:15)',
' at CleartextStream.Parser.cbReadable (../node_modules/mail-listener2/node_modules/imap/lib/Parser.js:53:12)',
' at CleartextStream.EventEmitter.emit (events.js:92:17)',
' at emitReadable (_stream_readable.js:392:10)',
' at _stream_readable.js:385:7' ]
What could cause this? should I be retrying differently? recreate MailListener object?