[SOLVED] 502 Bad Gateway after 4.4.5 Update, Failed To Create Index Error in Mattermost


Hi all,

I upgraded Mattermost to 4.4.5 (via GitLab 10.3.3’s Omnibus Upgrade) and now the Mattermost web interface is returning a 502 Bad Gateway error.

I’m looking in the Mattermost logs and see this repeatedly:
[2018/01/10 15:38:51 MST] [CRIT] Failed to create index pq: relation “idx_posts_channel_id_delete_at_create_at” does not exist
[2018/01/10 15:38:51 MST] [CRIT] Failed to create index pq: canceling statement due to user request

My guess is a database update failed at some point? Any ideas on what I can do to fix the underlying issue?


For anyone referencing this, I was able to fix this. I logged into the Mattermost database (sudo gitlab-psql -d mattermost_production) and ran the following query to create the missing index:

CREATE INDEX idx_posts_channel_id_delete_at_create_at ON Posts (ChannelId,DeleteAt,CreateAt)