Open delsner opened 7 years ago
I've seen the same issue at Connection.js:1265
@mscdex Any idea why this might be happening? Hitting exactly the same issue. It was floating around a few days ago, but then went away. I thought something have fixed it. Now seeing it again, happens with Outlook after the last log message:
console.log node_modules/imap/lib/Parser.js:132
<= 'A3 OK LOGIN completed.'
console.log node_modules/imap/lib/Connection.js:1737
=> 'A4 CAPABILITY'
console.log node_modules/imap/lib/Parser.js:132
<= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CLIENTACCESSRULES CLIENTNETWORKPRESENCELOCATION BACKENDAUTHENTICATE CHILDREN IDLE NAMESPACE LITERAL+'
console.log node_modules/imap/lib/Parser.js:132
<= 'A4 OK CAPABILITY completed.'
console.log node_modules/imap/lib/Connection.js:1737
=> 'A5 NAMESPACE'
console.log node_modules/imap/lib/Parser.js:132
<= '* NAMESPACE (("" "/")) NIL NIL'
console.log node_modules/imap/lib/Parser.js:132
<= 'A5 OK NAMESPACE completed.'
console.log node_modules/imap/lib/Connection.js:1737
=> 'A6 LIST "" ""'
console.log node_modules/imap/lib/Parser.js:132
<= '* LIST (\\Noselect \\HasChildren) "/" ""'
console.log node_modules/imap/lib/Parser.js:132
<= 'A6 OK LIST completed.'
console.log node_modules/imap/lib/Connection.js:1737
=> 'IDLE IDLE'
console.log node_modules/imap/lib/Connection.js:137
[connection] Connected to host
console.log node_modules/imap/lib/Parser.js:132
<= '+ IDLE accepted, awaiting DONE command.'
VM1001 Connection.js:227 Uncaught TypeError: Cannot read property 'type' of undefined
at Parser.<anonymous> (VM1001 Connection.js:227)
This issue has been open for four years, why hasn't it been fixed?
As stated above the problem is there is no check for the existence of a _curReq
here:
parser.on('continue', function(info) {
var type = self._curReq.type;
For me it appeared this issue arose when not wating on internal "LOGOUT" - which is signalled via 'end'-Event.
I was releasing the socket through imap.end()
but did not wait for arrival of 'end'-Event already doing the next connect. After making sure imap.connect()
runs always after 'end'-Event has fired:
I eventually ended up with something like this:
/* just a simple loop and lock / 'semaphore' */
let lock = false;
while(1) {
if(lock) continue;
lock = true;
imap.once('ready', () => {
/*...*/
imap.end()
})
imap.once('end', () => {
/* IMPORTANT: unlock next run of connect not earlier than here */
lock = false
});
imap.connect();
}
imap.once('end', () => {...})
Unfortunately, I'm getting a type error when I'm fetching boxes from my gmail imap:
Fetching
Error
The line 226 is
var type = self._curReq.type;
in the context:I would appreciate any kind of help! Using version 0.8.19. Thank you.