'How to solve "Error: Timed out while connecting to server" using ethereal email in Cypress
I am testing my project using Cypress, and to receive emails (on registering as a new user for example) I use ethereal email.
The tests used to work fine before, but today no imap connection seems to get established. Here is the code for establishing the connection
const nodemailer = require('nodemailer');
const imaps = require('imap-simple');
const testAccount = await nodemailer.createTestAccount();
  const emailConfig = {
    imap: {
      user: testAccount.user,
      password: testAccount.pass,
      host: 'imap.ethereal.email',
      port: 993,
      tls: true,
      authTimeout: 10000,
    }
  };
const connection = await imaps.connect(emailConfig);
The error I am getting is
Error: Timed out while connecting to server
    at Timeout._onTimeout (/media/hesham/Cypress Tests/node_modules/imap/lib/Connection.js:280:15)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7) {
  source: 'timeout'
}
I even tried adding extra timeout to the imap options
authTimeout: 1000000,
connTimeout: 1000000,
socketTimeout: 1000000,
But no connection was established in this case either and I got this error
[connection] Error: Error: connect ETIMEDOUT 54.36.85.113:993
Error: connect ETIMEDOUT 54.36.85.113:993
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ETIMEDOUT',
  code: 'ETIMEDOUT',
  syscall: 'connect',
  address: '54.36.85.113',
  port: 993,
  source: 'socket'
}
This problem did not show up before, is there a problem with ethereal service? If so, what other alternatives do I have?
Solution 1:[1]
It might be a problem with ethereal services because I receive the same timeout error.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|---|
| Solution 1 | heyitsmave | 
