mautrix / whatsapp

A Matrix-WhatsApp puppeting bridge
https://maunium.net/go/mautrix-whatsapp
GNU Affero General Public License v3.0
1.21k stars 170 forks source link

[Dendrite] Bot doesn't process the join request properly and it leaves instantly from the room #606

Closed Fijxu closed 1 year ago

Fijxu commented 1 year ago

I was installing this bot on my own bleeding edge dendrite instance (latest commits) but i found out the problem that the bot leaves instantly from the room for no reason. After a lot of hours of testing, i found out that the bot leaves instantly from the room when it's invited when it does a GET request to _matrix/client/v3/rooms/%21<mxid>/joined_members?user_id=<mxid>. And 90% of the time that returns this JSON:

{
    "joined": {
        "@fijxu:zzls.xyz": {
            "avatar_url": "mxc://zzls.xyz/23ee4977991b2170086cf62d4f67b8e90106c181772749eb3f35c217e3f02b6a",
            "display_name": "Fijxu"
        }
    }
}

When it's supposed to return (When the bot does the GET request and recieves this repsonse, the bot works well and it doesn't leave from the room)

{
    "joined": {
        "@fijxu:zzls.xyz": {
            "avatar_url": "mxc://zzls.xyz/23ee4977991b2170086cf62d4f67b8e90106c181772749eb3f35c217e3f02b6a",
            "display_name": "Fijxu"
        },
        "@whatsapp:zzls.xyz": {
            "avatar_url": "mxc://maunium.net/NeXNQarUbrlYBiPCpprYsRqr",
            "display_name": "WhatsApp bridge bot"
        }
    }
}

Using mautrix-whatsapp at commit dec2f81fbef4a80126b82b7e86d779442ce1ea6a with postgresql. The bot and the matrix instance are running in the same machine.

I also have to note that using mitmproxy (the tool that i used to inspect the traffic between the bot and my matrix instance) increases the chances that the bot joins properly into the room and work as intended. The debug logs of the bot doesn't show anything intresting, just DBG Leaving empty room after accepting invite but that is normal i guess. If you need more details let me know

tulir commented 1 year ago

This is a dendrite bug

Fijxu commented 1 year ago

This is a dendrite bug

Thanks, is a already known bug? Or i have to report it to Dendrite? What is exactly failing here with dendrite?

bahuma20 commented 1 year ago

Just reporting that i have the same bug...

@tulir Did you find any solution yet?

sumnerevans commented 1 year ago

The solution is to not use Dendrite because it has some serious state bugs.

bahuma20 commented 1 year ago

Therefore i created https://github.com/matrix-org/dendrite/issues/3116 😅