Skip to content

Conversation

mex
Copy link
Contributor

@mex mex commented Sep 30, 2025

When connecting using TLS there is an optional field, servername, for setting the Server Name Indication (SNI) but this field only makes sense to set if we are using a hostname to connect and not an IP. Since v12 of Node.js, it's been deprecated to provide an IP address as the SNI so it will be ignored at some point anyway.

This PR prevents setting servername in the TLS config if the MySQL config host field is an IP which in turn quiets this deprecation warning:

(node:1) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.

The logic for setting SNI to the host was originally added in #1554.

Fixes #2588

Copy link

codecov bot commented Sep 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.83%. Comparing base (e38aeea) to head (8f930ef).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3835   +/-   ##
=======================================
  Coverage   89.83%   89.83%           
=======================================
  Files          86       86           
  Lines       13596    13600    +4     
  Branches     1606     1606           
=======================================
+ Hits        12214    12218    +4     
  Misses       1382     1382           
Flag Coverage Δ
compression-0 88.94% <100.00%> (+<0.01%) ⬆️
compression-1 89.81% <100.00%> (+<0.01%) ⬆️
static-parser-0 87.41% <100.00%> (+<0.01%) ⬆️
static-parser-1 88.17% <100.00%> (+<0.01%) ⬆️
tls-0 89.22% <0.00%> (-0.03%) ⬇️
tls-1 89.61% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bertho-zero
Copy link

It should be possible to choose the servername. I connect with an IP address, but the certificate is generated with a domain (the FQDN) in the alt_names that isn't on any public DNS.

By connecting with an IP address as host and a servername for the SSL configuration, this warning disappears.

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

Successfully merging this pull request may close these issues.

got warning when host is an IP address
2 participants