42wim / matterbridge

bridge between mattermost, IRC, gitter, xmpp, slack, discord, telegram, rocketchat, twitch, ssh-chat, zulip, whatsapp, keybase, matrix, microsoft teams, nextcloud, mumble, vk and more with REST API (mattermost not required!)
Apache License 2.0
6.55k stars 617 forks source link

Mattermost team not found in [] #1902

Open badrihippo opened 1 year ago

badrihippo commented 1 year ago

Describe the bug The Mattermost XMPP bridge fails with the error Starting gateway failed: Bridge mattermost.myteam failed to start: Team 'myteam' not found in [].

A similar issue has already been described in passing at #1885 and #1782 but neither of the OPs specified logs (one of them ghosted and the other closed the issue without explanation). The same happened with this forum post Mattermost forum. If the problem is solved, those issues can be linked to point here.

To Reproduce Configure Mattermost (see below) and try to run the matterbridge command

Expected behavior Matterbridge should connect successfully to Mattermost!

Screenshots/debug logs Full (but anonymised) log:

$ ./matterbridge -conf matterbridge.toml  --debug
[0000]  INFO main:         [setupLogger:matterbridge.go:104] Enabling debug logging.
[0000]  INFO main:         [main:matterbridge.go:44] Running version 1.25.2 20f841c5
[0000]  INFO router:       [Start:gateway/router.go:66] Parsing gateway myteam
[0000]  INFO router:       [Start:gateway/router.go:75] Starting bridge: mattermost.myteam 
[0000]  INFO mattermost:   [Connect:bridge/mattermost/mattermost.go:76] Connecting using token (sending and receiving)
[0000]  INFO mattermost:   [Connect:bridge/mattermost/mattermost.go:77] Using mattermost v6 methods: true
[0000]  INFO mattermost:   [apiLogin6:bridge/mattermost/helpers.go:146] Connecting  (team: myteam) on mydomain.com/chat
[2022-10-20T03:59:24-07:00]  INFO matterclient: Found version 7.2.0.7.2.0.c58faf93a912bf23b212cb8e14b4b6e5.false
[0000] FATAL main:         [main:matterbridge.go:66] Starting gateway failed: Bridge mattermost.myteam failed to start: Team 'myteam' not found in []

Environment (please complete the following information):

Additional context Here is the Mattermost part of my config. I also have an XMPP config, which is working properly, which I have commented out while testing. The error can be reproduced even without configuring the XMPP part.

[mattermost.myteam]
Server="mydomain.com/chat"
Team="myteam"
Token="XYZ123ABC"
NoTLS=false
RemoteNickFormat="{NICK} (via {PROTOCOL})"
PrefixMessagesWithNick=false
PreserveThreading=true
SkipVersionCheck=false # doesn't work even if I set it to true

[[gateway]]
name="myteam"
enable=true

[[gateway.inout]]
account="mattermost.myteam"
channel="town-square"

I have created a bot account in Mattermost for this application to connect to (an actual bot account, not a normal user account). I was getting an "invalid or expired session" error when connecting via localhost behind the reverse-proxy, so I switched to using the public https URL directly, at which point the "team not found" error started showing up.

As suggested in the same forum post, I tried changing SkipVersionCheck to true but that didn't help.

Another point to note: my Mattermost is on a subpath (mydomain.com/chat), not on a root domain (chat.mydomain.com). I don't think that should matter, but just putting it out there.

When I use WebSocket instead of a bot account, matterbridge runs nicely.

42wim commented 1 year ago

Can you try to do it with a separate "real" user ? Matterbridge has never been tested with mattermost bot users.

COFIEM-Informatique commented 1 year ago

have the same probleme (wanted to bridge with xmpp ) mattermost v7.10.2 matterbridge v1.26.0 [edit] but resolved specifiying a webhook in

tyrosinase commented 11 months ago

Same issue here, bridging Discord/Mattermost 9.0.0. Real mattermost user, though I'm not sure it's getting that far. Hyphenated team name, but that seems pretty common.