aldinokemal / go-whatsapp-web-multidevice

API for Whatsapp Web Multi Device Version, Support UI & Webhook
MIT License
485 stars 211 forks source link

🐞 Audio, Video and some files are not received by webhook #157

Closed abdbbdii closed 2 months ago

abdbbdii commented 3 months ago

What happened?

When I receive one of the following, I get an error: [Client ERROR] Event handler panicked while handling a *events.Message: runtime error: index out of range [0] with length 0

Reproduction Steps

1. Connect webhook to the application
2. Login to your WhatsApp using application
3. Send yourself one of the following:
- GIF as image
- Audio
- Video
- All files other than JSON and PDF

Relevant log output

2024-06-06 14:44:23 whatsapp_go-1  | 09:44:23.306 [Client ERROR] Event handler panicked while handling a *events.Message: runtime error: index out of range [0] with length 0
2024-06-06 14:44:23 whatsapp_go-1  | goroutine 16999 [running]:
2024-06-06 14:44:23 whatsapp_go-1  | runtime/debug.Stack()
2024-06-06 14:44:23 whatsapp_go-1  |    /usr/local/go/src/runtime/debug/stack.go:24 +0x5e
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).dispatchEvent.func1()
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/client.go:758 +0x7d
2024-06-06 14:44:23 whatsapp_go-1  | panic({0xe1c520?, 0xc000d90198?})
2024-06-06 14:44:23 whatsapp_go-1  |    /usr/local/go/src/runtime/panic.go:914 +0x21f
2024-06-06 14:44:23 whatsapp_go-1  | github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/whatsapp.ExtractMedia({0xe914ff, 0xd}, {0xfdc720, 0xc000390140?})
2024-06-06 14:44:23 whatsapp_go-1  |    /whatsapp/pkg/whatsapp/whatsapp.go:462 +0x4c5
2024-06-06 14:44:23 whatsapp_go-1  | github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/whatsapp.forwardToWebhook(0xc00115e000)
2024-06-06 14:44:23 whatsapp_go-1  |    /whatsapp/pkg/whatsapp/whatsapp.go:387 +0x1029
2024-06-06 14:44:23 whatsapp_go-1  | github.com/aldinokemal/go-whatsapp-web-multidevice/pkg/whatsapp.handler({0xd4d860?, 0xc00115e000?})
2024-06-06 14:44:23 whatsapp_go-1  |    /whatsapp/pkg/whatsapp/whatsapp.go:260 +0x19dd
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).dispatchEvent(0xc00115e000?, {0xd4d860?, 0xc00115e000})
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/client.go:762 +0xd5
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).handleDecryptedMessage(0xc0001226c0?, 0xc00027c480, 0xc000296a00, 0x0)
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/message.go:576 +0xe5
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).decryptMessages(0xc000490000, 0xc00027c480, 0xc0006663f0)
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/message.go:231 +0xc25
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).handleEncryptedMessage(0xc000490000, 0xc0006663f0)
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/message.go:51 +0x39a
2024-06-06 14:44:23 whatsapp_go-1  | go.mau.fi/whatsmeow.(*Client).handlerQueueLoop.func1()
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/client.go:709 +0x83
2024-06-06 14:44:23 whatsapp_go-1  | created by go.mau.fi/whatsmeow.(*Client).handlerQueueLoop in goroutine 16004
2024-06-06 14:44:23 whatsapp_go-1  |    /go/pkg/mod/go.mau.fi/whatsmeow@v0.0.0-20240523075404-7f13c31d2cb1/client.go:707 +0x195

Screenshots or Additional Context

No response

Application Version

4.14.0

Verification

aldinokemal commented 3 months ago

seems working fine from my end @abdbbdii