Still problems with Postgresql server connection and SSL configuration

For feature requests, please see: https://mattermost.com/suggestions/.

For troubleshooting questions, please post in the following format:

Summary
"pq: SSL is not enabled on the server"

Steps to reproduce
Follow this guide to set up the Postgres server: Prepare your Mattermost database - Mattermost documentation

Then followed the advice from support for adding the ?sslmode=disable to the DataSource in the Mattermost config.json file.

Expected behavior
Expect it to bypass trying to use SSL for the connection.

Observed behavior
What did you see happen? Please include relevant error messages and/or screenshots.

$ bin/mattermost 
{"timestamp":"2024-12-17 21:11:49.993 Z","level":"debug","msg":"Advanced logging config not provided for logging","caller":"platform/config.go:165"}
{"timestamp":"2024-12-17 21:11:49.993 Z","level":"debug","msg":"Advanced logging config not provided for notification logging","caller":"platform/config.go:165"}
{"timestamp":"2024-12-17 21:11:49.994 Z","level":"info","msg":"Successfully connected to cache backend","caller":"platform/service.go:185","backend":"lru","result":"OK"}
{"timestamp":"2024-12-17 21:11:49.994 Z","level":"info","msg":"Server is initializing...","caller":"platform/service.go:188","go_version":"go1.22.6"}
{"timestamp":"2024-12-17 21:11:49.995 Z","level":"info","msg":"Pinging SQL","caller":"sql/sql_utils.go:67","database":"master","dataSource":"matteradmin:password@mydomain.com:5432/mattermost?sslmode=disable"}
{"timestamp":"2024-12-17 21:11:50.000 Z","level":"error","msg":"Failed to ping DB","caller":"sql/sql_utils.go:75","database":"master","dataSource":"matteradmin:password@mydomain.com:5432/mattermost?sslmode=disable","retrying in seconds":10,"error":"pq: SSL is not enabled on the server"}

Shouldn’t adding the sslmode=disable correct this?

Fedora Server 41
Postgresql 16.3
Mattermost 10.3.1

My first thought is you might have a funny character or formatting in your DataSource line. For reference:

"DataSource": "postgres://mmuser:password@localhost/mattermost?sslmode=disable\u0026connect_timeout=10\u0026binary_parameters=yes",

The \u0026 is unicode for the ampersand character (&). I have made it the actual character and saving/restarting the Mattermost server changes it to unicode.

And is the postgres:// prefix required? I thought the DriverName parameter was tacked on by the server as the prefix.

How are you editing the config.json? I doubt Mattermost is changing characters… I have a feeling maybe your editor or shell is.

As far as postgres://, AFAIK yes, that’s required.

I’m using vim. I’ve never known vim to change any character like that. Any my shell is bash.

Maybe chmod 440 config.json to be sure nothing is writing changes to it?

Are there any funny characters in your password? Maybe temporarily set a simpler password to eliminate the possibility that something is interpreting them.

Well, in typical ask-for-official-help tradition, the connection is working now without the SSL error. I’m now staring down a list of warnings when trying to pgloader migration.load the changes. I’ll need to research these column type changes.

Thanks for responding. I think we can consider this matter closed, although it won’t really help anyone searching for answers in the future other than to carefully double check all the things.