Imap issues in Atlas Function

I am trying to use the nodejs imap module in an atlas function, but I am getting this obsecure assertion error. This works locally for me. The source of the module is here:

AssertionError [ERR_ASSERTION]: false == true
	at construct (native)
	at f (assert:9:28407(14))
	at r (assert:9:27825(12))
	at call (native)
	at e (assert:9:34013(426))
	at E (assert:9:9919(33))
	at apply (native)
	at A (assert:9:10137(37))
	at <eval>:502:10(124)
	at TLSSocket (<eval>:337:13(91))
	at connect (<eval>:683:17(111))
	at node_modules/imap/lib/Connection.js:128:43(100)
	at run (node_modules/cwhite-gmail-watcher/index.js:139:24(25))
	at _callee$ (function.js:51:10(72))
	at call (native)
	at tryCatch (function.js:2:1(8))
	at function.js:2:1(101)
	at function.js:2:1(5)
	at call (native)
	at tryCatch (function.js:2:1(8))
	at invoke (function.js:2:1(8))
	at function.js:2:1(7)
	at <eval>:3:7(6)
	at callInvokeWithMethodAndArg (function.js:2:1(3))
	at fun