matterbridge: Crash while connecting to newest Whatsapp for Android
Environment
Version: 1.24.0 65c7ac80 (downloaded release)
Operating system: Ubuntu 20.04 x86_64 with Linux 5.4.0-100-generic
Please describe the expected behavior.
After scanning the QR code to link a device to Whatsapp, the bridge should go on with its other tasks (ie. connecting to other bridges, and eventually starting message relaying).
Please describe the actual behavior.
Bridge panics after QR code is scanned.
This was tried with the previous .gob
file, and with no .gob
file at all.
Logs:
$ matterbridge --debug
[0000] INFO main: [setupLogger:matterbridge.go:104] Enabling debug logging.
[0000] INFO main: [main:matterbridge.go:44] Running version 1.24.0 65c7ac80
[0000] INFO router: [Start:gateway/router.go:66] Parsing gateway gateway-abcd1234
[0000] INFO router: [Start:gateway/router.go:75] Starting bridge: telegram.abcd1234
[0000] INFO telegram: [Connect:bridge/telegram/telegram.go:44] Connecting
[0000] INFO telegram: [Connect:bridge/telegram/telegram.go:53] Connection succeeded
[0000] INFO telegram: [joinChannels:bridge/bridge.go:77] telegram.abcd1234 joining -123456789 (ID: -123456789telegram.abcd1234)
[0000] INFO router: [Start:gateway/router.go:75] Starting bridge: whatsapp.abcd1234
[0000] DEBUG whatsapp: [Connect:bridge/whatsapp/whatsapp.go:64] Connecting to WhatsApp..
[0000] DEBUG whatsapp: [Connect:bridge/whatsapp/whatsapp.go:73] WhatsApp connection successful
[0000] WARN whatsapp: [restoreSession:bridge/whatsapp/helpers.go:80] open abcd1234.gob: no such file or directory
[0000] DEBUG whatsapp: [restoreSession:bridge/whatsapp/helpers.go:83] Restoring WhatsApp session..
[0020] WARN whatsapp: [Connect:bridge/whatsapp/whatsapp.go:78] failed to restore session: admin login responded with 403
[0020] DEBUG whatsapp: [Login:bridge/whatsapp/whatsapp.go:133] Logging in..
<Whatsapp QR code here>
panic: interface conversion: interface {} is nil, not map[string]interface {}
goroutine 1 [running]:
github.com/Rhymen/go-whatsapp.newInfoFromReq(0xc000a4c040)
/go/src/github.com/42wim/matterbridge/vendor/github.com/Rhymen/go-whatsapp/session.go:63 +0x951
github.com/Rhymen/go-whatsapp.(*Conn).Login(0xc0000a6b00, 0xc0000bc2c0)
/go/src/github.com/42wim/matterbridge/vendor/github.com/Rhymen/go-whatsapp/session.go:268 +0xd36
github.com/42wim/matterbridge/bridge/whatsapp.(*Bwhatsapp).Login(0xc00014fb00)
/go/src/github.com/42wim/matterbridge/bridge/whatsapp/whatsapp.go:138 +0x10f
github.com/42wim/matterbridge/bridge/whatsapp.(*Bwhatsapp).Connect(0xc00014fb00)
/go/src/github.com/42wim/matterbridge/bridge/whatsapp/whatsapp.go:83 +0x2c5
github.com/42wim/matterbridge/gateway.(*Router).Start(0xc00014c500)
/go/src/github.com/42wim/matterbridge/gateway/router.go:76 +0x35f
main.main()
/go/src/github.com/42wim/matterbridge/matterbridge.go:65 +0x3be
Any steps to reproduce the behavior?
- Update to the latest Whatsapp for Android version as of today: 2.22.4.74 (220474005)
- Start the Android app
- Tap on the three-dot menu
- Tap on “Linked devices”
- Tap on “Link a device”. The QR scanning screen should appear.
- Allow Whatsapp to use the camera if necessary
- Start the bridge
- When the QR shows up, scan it with the Android device
- See the panic report
Please add your configuration file
matterbridge.toml:
[whatsapp.abcd1234]
Number=+123456789012
SessionFile="abcd1234.gob"
QrOnWhiteTerminal=false
RemoteNickFormat=""
MessageFormat=""
[telegram.abcd1234]
Token="<tg_bot_token>""
MessageFormat="HTML"
RemoteNickFormat="<b>{NICK}:</b> "
[[gateway]]
name="gateway-abcd1234"
enable=true
[[gateway.inout]]
account="whatsapp.abcd1234"
channel="123456789012345678@g.us"
[[gateway.inout]]
account="telegram.abcd1234"
channel="-123456789"
[tengo]
InMessage="tg.tengo"
tg.tengo:
text := import("text")
isWhatsapp := text.re_match("@", msgChannel)
if (isWhatsapp) {
} else {
}
// msgText=text.re_replace("\*\*",msgText,"blah")
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 15 (8 by maintainers)
Yes, sorry, no other way to do this because of the license. I’ll add a Dockerfile for specifically building with multidevice support.
This issue is fixed wit this PR: https://github.com/42wim/matterbridge/pull/1702 A few more tester could be helpful before it gets in the main release.
I’m going to close this, you should switch to the multidevice version
https://github.com/42wim/matterbridge#building-with-whatsapp-beta-multidevice-support
Thanks for your reply @jzvi12. Totally understandable!
I have no idea of Go, so I just tried building branches with later versions of key libraries (spoiler: no success).
Building
master
with the latestgo-whatsapp
(from Jan 19), I could still reproduce the issue reported here.Building
whatsappmeowupdate
as-is (as of today), it segfaults before showing the QR code.Building it with the latest
whatsmeow
(from Jan 26) , it did go better:I think the solution may come directly from
whatsmeow
themselves. Either way I’ll leave this to the pros.Thanks again, and thanks to Wim and the team for this great project!
It looks like it’s going to take a while for a fix since the whatsmeowupdate is very buggy and there is nobody (at the moment) that will take some time to update the code
@42wim wrote in the Discord channel: