Server password authentication failing on websockets streaming

I recently migrated my instance to Ubuntu 20.04, using the official server setup/migration instructions. Everything works fine except for websockets.

In the browser I notice that websocket connections are failing, with a message Firefox can’t establish a connection to the server at wss://ausglam.space/api/v1/streaming/?. and similar message in Chrome. Note that there is no authentication param here, unlike other troubleshooting reports I’ve seen. This turns out to be a 401 error i.e. can’t authenticate to the streaming service.

When I manually run a websockets connection request using a nodejs server on my local machine (i.e. not my server), including an authentication token param in the user scope, I still get a 401 error. Looking at my server logs I realised these requests are all hitting a node error on the server: node[259664]: ERR! error: password authentication failed for user "mastodon". I’m guessing this is because my mastodon user doesn’t have a password, as per the instructions. This required me to amend the standard install instructions to not pass through a DB_PASS value because the empty string caused postgres to fail for the web service, but this seems to be causing issues on the streaming service. I’m not sure whether this is because the streaming service wants a (blank) password value, or if there is some unreconcilable difference in how the two services handle postres authentication.

I’m fairly out of my depth here, knowing not much about postgres (which I assume is where the authentication error is coming from), so if anyone has any suggestions I’d be grateful.

I couldn’t work out any way to resolve this other than to create a password for the mastodon postgres account. Which is not a terrible solution or anything, but the setup docs clearly need to be re-written. I’ll post in the github repo about that.

Maybe the mastodon comes from the default user name because -U was missing somewhere in psql invocation?

The setup instructions include explicitly creating a mastodon database user and not creating a password for that user.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.