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.

Unable to connect to Gmail

See original GitHub issue

Upon imap.connect() I get:

Uncaught Error: self signed certificate
...
  code: 'DEPTH_ZERO_SELF_SIGNED_CERT',
  source: 'socket',
  domainEmitter: Connection {
    _events: [Object: null prototype] { ready: [Function], end: [Function] },
    _eventsCount: 2,
    _maxListeners: undefined,
    _config: {
      localAddress: undefined,
      socket: undefined,
      socketTimeout: 0,
      host: 'imap.gmail.com',
      port: 993,
      tls: true,
      tlsOptions: undefined,
      autotls: undefined,
      user: <my gmail id>,
      password: <my google app password>,
      xoauth: undefined,
      xoauth2: <my access token>,
      connTimeout: 10000,
      authTimeout: 5000,
      keepalive: true
    },
...

My IMAP is enabled; I have 2FA; I tried an App Password only (didn’t work); I tried adding the xoauth2 token.

Anyone can help? Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
TechStudent10commented, Aug 10, 2022

For everyone who still gets this error, you need to add tlsOptions: {servername: "<imap server/host parameter>"} to the Imap() object.

2reactions
dzgcommented, Feb 17, 2022

This solved the issue for me: https://stackoverflow.com/a/60126034/1166371

Add tlsOptions: { rejectUnauthorized: false }

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't sign in to your Google Account
If you can't sign in to your Google Account in Gmail, Google Drive, Google Play, or elsewhere, select the issue that most closely...
Read more >
Gmail Won't Load? How to Fix It - Lifewire
Restart the computer. · Make sure the browser works with Gmail. · Use another browser or device. · Check the browser extensions or...
Read more >
Fix problems connecting your Google account to the Microsoft ...
Step 1: Enable IMAP · In a browser, go to Gmail.com. · Select Settings > Settings. · Select the Forwarding and POP/IMAP tab....
Read more >
Is Gmail not working? Try these fixes! - Android Authority
Is Gmail down? · Close and reopen Gmail · Make sure Sync Gmail is on · Check for updates · Restart the device...
Read more >
Common Gmail Problems and How to Solve Them - Mailbird
Update the Gmail app: Sometimes an older, outdated version of the app can have trouble getting mail from Google. Making sure you have...
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