Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL Error in production. #993

Closed
TheFedaikin opened this issue Apr 1, 2019 · 5 comments
Closed

SSL Error in production. #993

TheFedaikin opened this issue Apr 1, 2019 · 5 comments

Comments

@TheFedaikin
Copy link

TheFedaikin commented Apr 1, 2019

Everything is working fine until I push it to production server.

Environment is the same:
NODE: v10.15.1
NODEMAILER: ^6.0.0
GMAIL: Oauth2

I get the error:

Error: 140591402215232:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
] code: 'ESOCKET', command: 'CONN'

LOG:

DEBUG Creating transport: nodemailer (6.0.0; +https://nodemailer.com/; SMTP/6.0.0[client:6.0.0])
DEBUG Sending mail using SMTP/6.0.0[client:6.0.0]
DEBUG [1B0c5FNSwGk] Resolved smtp.gmail.com as 74.125.131.109 [cache miss]
ERROR [1B0c5FNSwGk] 140128587040576:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
ERROR [1B0c5FNSwGk]
DEBUG [1B0c5FNSwGk] Closing connection to the server using "destroy"
ERROR Send Error: 140128587040576:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
ERROR

I've tried almost all combinations of transporters I can think of and almost all of them work on local machine, BUT in production I get the result above... Below my "final one". Is there a way to to fix this issue?

 const transporter = nodemailer.createTransport({
    service: 'gmail',
    debug: true,
    logger: true,
    auth: {
      type: 'OAuth2',
      user: G_USER,
      clientId: G_CLIENT_ID,
      clientSecret: G_CLIENT_SECRET,
      refreshToken: G_CLIENT_REFRESHTOKEN,
      accessToken: token
    },
    tls: {
      rejectUnauthorized: false
    }
  }
@ghost
Copy link

ghost commented Apr 5, 2019

Just as a work-around, did you try it with "secure = false"? This prevents Nodemailer from forcing to open a TLS connection and it's using STARTTLS instead. I know that STARTTLS is less secure (man in the middle) - but maybe helps you to get it working until someone with more clue on Nodmailer can help you.

@andris9
Copy link
Member

andris9 commented Apr 6, 2019

The error message indicates that you are trying to open a TLS connection against cleartext port. If the same config works on local but not in production then most cases it is some kind of proxy configuration issue in your server.

@andris9 andris9 closed this as completed Apr 6, 2019
@TheFedaikin
Copy link
Author

TheFedaikin commented Apr 21, 2019

@andris9 you were right, I didn't check it firsthand, and was battling the issue where it shouldn't be. It was related to proxy on the server. Thanks!

@ghost
Copy link

ghost commented Mar 14, 2021

I get similar error. I'm sending invitation email to about 800 users who are porting from our old app to new app. Some emails are sent, whereas, for sending other emails, I get this error.

{ [Error: 139629565937472:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331: ] code: 'ESOCKET', command: 'CONN' }

I checked the email addresses. Several emails are sent successfully to gmail ids and several others fail for gmail.

@juzerdhinoj-dimiour
Copy link

I get similar error. I'm sending invitation email to about 800 users who are porting from our old app to new app. Some emails are sent, whereas, for sending other emails, I get this error.

{ [Error: 139629565937472:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../ssl/record/ssl3_record.c:331: ] code: 'ESOCKET', command: 'CONN' }

I checked the email addresses. Several emails are sent successfully to gmail ids and several others fail for gmail.

I am facing a similar issue.
Error Log:

error: 140437940750208:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:332:

Can someone guide me to fix this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants