How would you resolve the [DEP0123] deprecation warning when using Cloud SQL from an external Node.js instance?
Asked Answered
R

2

6

When connecting to the CloudSQL DB, you must provide the PostgreSQL configuration details (this makes sense). When getting the necessary address information from Google's configuration page, you are provided with an external IP address (and nothing else as far as external solutions work) to connect to it. This then produces a warning when using it:

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

I have tried researching about this warning, and am struggling to come up with a proper resolution for this, since Google does not provide any sort of servername (or similar) for this. I'm thinking one solution could be to externally add a subdomain to my companies servers that points to this IP address, but to be honest that is not very ideal for us (if it's the only solution though, that is fine). This is a server running Node 12.7.0 on Debian 9.9 (stretch), connecting to CloudSQL PostgreSQL 11 (beta).

Obviously the expected solution is to remove all [deprecation] warnings from a production code-base, so looking to resolve that, and any ideas of how best to attack that since nobody seems to have posted this elsewhere!

Edit: I was able to resolve this by adding proper hostnames to said IPs. Not sure if there is a better solution (if you find one, please let me know!), but this will work in the interim since keeping the external server around is only a short-term scenario for us anyways. Related issue created for adding this to the documentation: https://github.com/brianc/node-postgres/issues/1950

Rotogravure answered 19/8, 2019 at 15:30 Comment(3)
Don't call a warning an error: it's just a warning about what might happen in a future version. As for the error itself, it was introduced in Node 12, and the solution is to find out which library is causing the error (which actual line of code that you wrote triggers it?), and then filing an issue with the maintainers of that library to make sure they don't use TLS but some other, permitted, protocol when handling a bare IP connection.Biagio
Thank you for the information! I guess that would point me to the official pg-node client library being the culprit, but must just be a misconfiguration on my part since it's not a common issue among people it seems. I hadn't thought that it was a mis-use of the protocol, and thought it was more related to the the fact that it's using an IP in general. This gives me something to work with!Rotogravure
file an issue. Worst case, it's you, but best case, you made the maintainers aware of a deficiency in their code base, and they are far more qualified than anyone on Stackoverflow when it comes to telling you which of the two it is.Biagio
L
2

I changed from IP name to DNS name and the error is gone.

Lytton answered 9/12, 2019 at 18:51 Comment(0)
W
0

You can change in ServerName: // your ip and just put "localhost".

Widower answered 1/4, 2022 at 12:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.