Issues Connecting Kong 3.x to Neon PostgreSQL Database with SSL

Hello,

I’m currently experiencing issues when trying to connect my Kong 3.x service to a Neon PostgreSQL database using SSL.

During the Kong startup, I’m encountering the following error:

[error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:587: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: ERROR: Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=endpoint%3D<endpoint-id>'. See more at https://neon.tech/sni

Following the error message’s advice, I tried appending the endpoint ID to the connection string as a parameter, like so:

postgres://admin:password@ep-quiet-shadow-xxxxxx.us-east-1.aws.neon.tech/kong?options=endpoint%3Dep-quiet-shadow-xxxxxx

However, this resulted in a new error:

[error] 1#0: init_by_lua error: /usr/local/share/lua/5.1/kong/init.lua:587: [PostgreSQL error] failed to retrieve PostgreSQL server_version_num: host or service not provided, or not known

I’ve confirmed that the hostname is correct, and I can resolve it via DNS lookup and ping it successfully from the machine where Kong is running. I’m not behind a firewall, and I’m using the latest version of Kong.

It seems that the issue might be related to the compatibility between Kong’s Lua-based PostgreSQL client and the Neon database service’s requirement for SNI (Server Name Indication) support.

I would greatly appreciate any advice or guidance on how to resolve this issue. Has anyone else encountered this problem and found a solution?

Thank you in advance for your help!