Oct 26 09:59:23 mattermost mattermost[10970]: {"level":"error","ts":1540547963.542068,"caller":"web/context.go:60","msg":"Invalid or missing channel_id parameter in request URL","path":"/api/v4/channels/undefined/posts","request_id":"A0","ip_addr":"2a01:7e01:e001::abcd","user_id":"A1","method":"GET","err_where":"Context","http_code":400,"err_details":""}
Mattermost version: 5.4.0
Firefox version: 62.0.3 (64-bit)
Chromium version: 69.0.3497.100 (Developer Build) (64-bit)
Safari version: 12.0
Just open mattermost chat in Firefox, Safari and Chromium.
In the Firefox and Safari request url is set to https://chat.example.com/api/v4/channels/undefined/posts?page=0&per_page=30 where channel is undefined.
In the Chromium request url is correct https://chat.example.com/api/v4/channels/A1/posts?page=0&per_page=30 where A1 is a real channel.
Request to /api/v4/channels must has a correct channel_id when page load.
Thank you @MrSorcus,
What do you see happen when you get the log error (Observed behaviour)?
Oct 26 09:59:23 mattermost mattermost[10970]: {"level":"error","ts":1540547963.542068,"caller":"web/context.go:60","msg":"Invalid or missing channel_id parameter in request URL","path":"/api/v4/channels/undefined/posts","request_id":"A0","ip_addr":"2a01:7e01:e001::abcd","user_id":"A1","method":"GET","err_where":"Context","http_code":400,"err_details":""}
This. I can reproduce it in Firefox.
Clear cookie / local storage / browser profile doesn't resolve problem.
Hmm. No. Error in chromium too.
Before i changed db from mariadb to postgresql.
Maybe something went wrong...?
What version of postgresql are you using?
Version: 10.5-2
From Archlinux repo.
There is an issue with Postgresql that our developers will start to investigate, so I'm wondering if the issue you're seeing is also related to it: https://github.com/mattermost/mattermost-server/issues/9745.
Are you sure? Because it depends on browser where i run mattermost client.
No error in chromium (rarely). No error in Mattermost Desktop.
But often i see error in Firefox.
Later i will try to reproduce error with clean installation.
Maybe tomorrow.
Ok. I can reproduce it with clean installation.
# pacman -Syu postgresql
# su postgres
$ initdb -D '/var/lib/postgres/data'
$ exit
# systemctl enable postgresql && systemctl start postgresql
$ su postgres
$ cd ~/ && psql
> CREATE ROLE mmuser WITH LOGIN PASSWORD 'SECURE';
> CREATE DATABASE mmdb;
> GRANT ALL PRIVILEGES ON DATABASE mmdb TO mmuser;
> \q
$ exit
# curl https://releases.mattermost.com/5.4.0/mattermost-team-5.4.0-linux-amd64.tar.gz --output mattermost-team-5.4.0-linux-amd64.tar.gz
# sha256sum mattermost-team-5.4.0-linux-amd64.tar.gz
# tar -xf mattermost-team-5.4.0-linux-amd64.tar.gz
config/config.json"ListenAddress": "[2a01:7e01:e001::abcd]:8065",
"DriverName": "postgres",
"DataSource": "postgres:///mmdb?user=mmuser\u0026host=/run/postgresql",
# ./bin/mattermost
Create two users test0 & test1
Create one team example
Login as test0, create direct message with test1, send something to him and reload page.
Get error {"level":"error","ts":1540624892.4515233,"caller":"web/context.go:60","msg":"Invalid or missing channel_id parameter in request URL","path":"/api/v4/channels/undefined/posts","request_id":"ig1jj...","ip_addr":"2a01:7e01::abcd","user_id":"yorpr...","method":"GET","err_where":"Context","http_code":400,"err_details":""}
If you needed, i can send you full SSH access (ssh public key required) to container (IPv6 only) for testing.
Hi @MrSorcus,
Are you seeing any other side effects from this that may help us diagnose the problem? Does the rest of the UI still load correctly even if it fails to load the posts? Are there any errors in the the JavaScript console on the browser?
@hmhealey no any errors in JS console.
Errors in mattermost logs and bad response in Network tab (dev. tools).
Yes, the UI is working, because second request (with correct id) return correct response.
But first request return status code 400. Because it used undefined instead of correct id.
Hi @MrSorcus,
I found a similar Issue that was reported earlier: https://github.com/mattermost/mattermost-server/issues/7403 - can you help check if the tips from prixone are useful throughout the thread?
I'm not sure if that's related since that's someone hitting the API directly. It sounds like we're hitting a race condition of some sort here. Like it's requesting posts for the channel before it actually knows what the channel is for some reason.
I'm looking at the code for that, and I can't actually find anywhere that it waits for the channel to be loaded before trying to get posts for it, so that seems like it might be the cause. Can you reproduce the issue at all if you use the network dev tools in Firefox to throttle the speed sligthly? You could also check to see if the request to /api/v4/users/me/teams/<teamid>/channels happens before or after the request for posts that's returning the error when it does error
I was comparing those against mine, and I was actually able to reproduce the issue. I also noticed you're opening the app in a DM channel in those screenshots and that's also when I had it happen, so I think that might be related to why it's just happening now.
I've filed a Jira ticket here to track it in more detail if you interested in following or helping out with that further.
Closing this as this has been fixed for v5.8 which will be released on February 16th
Most helpful comment
I was comparing those against mine, and I was actually able to reproduce the issue. I also noticed you're opening the app in a DM channel in those screenshots and that's also when I had it happen, so I think that might be related to why it's just happening now.
I've filed a Jira ticket here to track it in more detail if you interested in following or helping out with that further.