Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Messages sent from Matrix gets delivered to Discord as JSONs with error #2205

Open
Wohlstand opened this issue Jan 1, 2025 · 3 comments
Open
Labels

Comments

@Wohlstand
Copy link

Describe the bug
Several times, attempts of Matrix users to send images, on Discord side, images feels corruted, but when downloading that, I see it's a JSON with the next content:

{"errcode":"M_NOT_FOUND","error":"Not found"}

To Reproduce
Just send at the Matrix side any pictures. And then see how they shown at Discord.

Expected behavior
Images successfully delivered to Discord side and shown. If not as a native attachment, then just a link to local bridge's media storage (depending on config).

Screenshots/debug logs
изображение

Environment (please complete the following information):

  • OS: RockyLinux 8
  • Matterbridge version: 1.26.1-dev
  • If self compiled: Re-ran the go build of latest state at the moment of issue creation c4157a4, problem is still here.

Additional context
matterbridge.toml.zip

@dora71
Copy link

dora71 commented Jan 2, 2025

I have exactly the same problem when trying to bridge a matrix room to a xmpp muc.
I tried several attachements (not only pictures), all with the same result.

Using here the precompiled binary in Version 1.26

Same error is thrown. Here is the debug log:

[0571] DEBUG matrix:       [handleEvent:bridge/matrix/matrix.go:484] == Receiving event: &gomatrix.Event{StateKey:(*string)(nil), Sender:"@myname:tchncs.de", Type:"m.room.message", Timestamp:1735803464367, ID:"$zM0DX3_P3tu8-9CZaqImRL1-ju45bbeBbxfbLKdHsMc", RoomID:"!1234567890:matrix.org", Redacts:"", Unsigned:map[string]interface {}{"membership":"join"}, Content:map[string]interface {}{"body":"xmas-kakteen.jpg", "info":map[string]interface {}{"h":1440, "mimetype":"image/jpeg", "org.matrix.msc4230.is_animated":false, "size":170340, "w":1920, "xyz.amorgan.blurhash":"LPEV?4%MM{xu_Nj[R%of?vt7RPt7"}, "m.mentions":map[string]interface {}{}, "msgtype":"m.image", "url":"mxc://tchncs.de/0c42e0eaffa9acb73757fb2b4d0d77e504ad04541874721722423312384"}, PrevContent:map[string]interface {}(nil)}
[0572] DEBUG matrix:       [HandleDownloadSize:bridge/helper/helper.go:162] Trying to download "xmas-kakteen.jpg" with size 170340
[0572] DEBUG matrix:       [HandleDownloadData2:bridge/helper/helper.go:183] Download OK "xmas-kakteen.jpg" 45
[0572] DEBUG matrix:       [handleEvent:bridge/matrix/matrix.go:549] <= Sending message from @myname:tchncs.de on matrix.xxxxx to gateway
[0572] DEBUG gateway:      [handleFilesLocal:gateway/handlers.go:158] mediaserver path placing file: /mnt/clouddrive/html/xmpp/filesup/702fee26/xmas_kakteen.jpg
[0572] DEBUG gateway:      [handleFiles:gateway/handlers.go:112] mediaserver download URL = https://xmpp.example.de/filesup/702fee26/xmas_kakteen.jpg
[0572] DEBUG gateway:      [SendMessage:gateway/gateway.go:499] => Sending config.Message{Text:"xmas-kakteen.jpg", Channel:"!1234567890:matrix.org", Username:"xxxxx", UserID:"@myname:tchncs.de", Avatar:"https://matrix.org/_matrix/media/r0/thumbnail/tchncs.de/9c5fbaac2062afe27b1fce1813d4c3f91c1c32931849844469654880256?width=37&height=37&method=crop", Account:"matrix.xxxxx", Event:"", Protocol:"matrix", Gateway:"bridge-matrix-xmpp", ParentID:"", Timestamp:time.Date(2025, time.January, 2, 8, 37, 45, 302468447, time.Local), ID:"$zM0DX3_P3tu8-9CZaqImRL1-ju45bbeBbxfbLKdHsMc", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"xmas-kakteen.jpg", Data:(*[]uint8)(0xc0000102d0), Comment:"", URL:"https://xmpp.example.de/filesup/702fee26/xmas_kakteen.jpg", Size:0, Avatar:false, SHA:"702fee26", NativeID:""}}}} from matrix.xxxxx (!1234567890:matrix.org) to xmpp.xxxxx (naturepics)
[0572] DEBUG xmpp:         [Send:bridge/xmpp/xmpp.go:80] => Receiving config.Message{Text:"xmas-kakteen.jpg", Channel:"mychannel", Username:"<myname>", UserID:"@myname:tchncs.de", Avatar:"https://matrix.org/_matrix/media/r0/thumbnail/tchncs.de/9c5fbaac2062afe27b1fce1813d4c3f91c1c32931849844469654880256?width=37&height=37&method=crop", Account:"matrix.xxxxx", Event:"", Protocol:"matrix", Gateway:"bridge-matrix-xmpp", ParentID:"", Timestamp:time.Date(2025, time.January, 2, 8, 37, 45, 302468447, time.Local), ID:"", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"xmas-kakteen.jpg", Data:(*[]uint8)(0xc0000102d0), Comment:"", URL:"https://xmpp.example.de/filesup/702fee26/xmas_kakteen.jpg", Size:0, Avatar:false, SHA:"702fee26", NativeID:""}}}}
[0572] DEBUG gateway:      [func1:gateway/gateway.go:508] => Send from matrix.xxxxx (!mtQgtpUzWuzMTRSphe:matrix.org) to xmpp.xxxxx (naturepics) took 213.097µs
[0572] DEBUG xmpp:         [handleXMPP:bridge/xmpp/xmpp.go:298] == Receiving xmpp.Chat{Remote:"[email protected]/IRCBot", Type:"groupchat", Text:"<Rainer>https://xmpp.example.de/filesup/702fee26/xmas_kakteen.jpg", Subject:"", Thread:"", Ooburl:"", Oobdesc:"", ID:"669cb3fe0190f55f", ReplaceID:"", Roster:xmpp.Roster(nil), Other:[]string{"", ""}, OtherElem:[]xmpp.XMLElement{xmpp.XMLElement{XMLName:xml.Name{Space:"urn:xmpp:occupant-id:0", Local:"occupant-id"}, InnerXML:""}, xmpp.XMLElement{XMLName:xml.Name{Space:"urn:xmpp:sid:0", Local:"stanza-id"}, InnerXML:""}}, Stamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}
[0572] DEBUG xmpp:         [handleXMPP:bridge/xmpp/xmpp.go:298] == Receiving xmpp.Chat{Remote:"[email protected]/IRCBot", Type:"groupchat", Text:"", Subject:"", Thread:"", Ooburl:"", Oobdesc:"", ID:"e63e15d48babd8f5", ReplaceID:"", Roster:xmpp.Roster(nil), Other:[]string{"", ""}, OtherElem:[]xmpp.XMLElement{xmpp.XMLElement{XMLName:xml.Name{Space:"jabber:x:oob", Local:"x"}, InnerXML:"<url>https://xmpp.example.de/filesup/702fee26/xmas_kakteen.jpg</url>"}, xmpp.XMLElement{XMLName:xml.Name{Space:"urn:xmpp:occupant-id:0", Local:"occupant-id"}, InnerXML:""}}, Stamp:time.Date(1, time.January, 1, 0, 0, 0, 0, time.UTC)}

Hope that helps in investigating further (and glad I am not the only one!).

@trilkk
Copy link

trilkk commented Jan 9, 2025

Having the same issue when matterbridge is bridging Matrix and IRC. Example log:

[0548] DEBUG matrix:       [handleEvent:bridge/matrix/matrix.go:484] == Receiving event: &gomatrix.Event{StateK
ey:(*string)(nil), Sender:"@user:matrix.server.url", Type:"m.room.message", Timestamp:1736448211090, ID:"$r5
7XCQOeuTAaHlhh63dOFT5AHPPOxdNJOw38tqjhEvc", RoomID:"!<hash>:matrix.server.url", Redacts:"", Unsign
ed:map[string]interface {}{"age":27, "membership":"join"}, Content:map[string]interface {}{"body":"1000060144.j
pg", "info":map[string]interface {}{"h":717, "mimetype":"image/jpeg", "size":117293, "w":1024}, "msgtype":"m.image", "url":"mxc://matrix.server.url/lKZtyHOcxkNyjaNLZsqYXzpR"}, PrevContent:map[string]interface {}(nil)}
[0548] DEBUG matrix:       [HandleDownloadSize:bridge/helper/helper.go:162] Trying to download "1000060144.jpg" with size 117293
[0548] DEBUG matrix:       [HandleDownloadData2:bridge/helper/helper.go:183] Download OK "1000060144.jpg" 45
[0548] DEBUG matrix:       [handleEvent:bridge/matrix/matrix.go:549] <= Sending message from @user:matrix.server.url on matrix.server to gateway
[0548] DEBUG gateway:      [handleFilesLocal:gateway/handlers.go:158] mediaserver path placing file: /media/file/path/702fee26/1000060144.jpg
[0548] DEBUG gateway:      [handleFiles:gateway/handlers.go:112] mediaserver download URL = https://matrix.server.url/702fee26/1000060144.jpg
[0548] DEBUG gateway:      [SendMessage:gateway/gateway.go:499] => Sending config.Message{Text:"1000060144.jpg", Channel:"!<hash>:matrix.server.url", Username:"User", UserID:"@user:matrix.server.url", Avatar:"https://matrix.server.url:8448/_matrix/media/r0/thumbnail/matrix.server.url/lsPyqCCIqDpyaGzqspGxWcTh?width=37&height=37&method=crop", Account:"matrix.server", Event:"", Protocol:"matrix", Gateway:"irc_matrix_bridge_config", ParentID:"", Timestamp:time.Date(2025, time.January, 9, 18, 43, 31, 213407181, time.Local), ID:"$r57XCQOeuTAaHlhh63dOFT5AHPPOxdNJOw38tqjhEvc", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"1000060144.jpg", Data:(*[]uint8)(0x3416e810), Comment:"", URL:"https://matrix.server.url/702fee26/1000060144.jpg", Size:0, Avatar:false, SHA:"702fee26", NativeID:""}}}} from matrix.server (!<hash>:matrix.server.url) to irc.libera (#irc_channel_name)
[0548] DEBUG irc:          [Send:bridge/irc/irc.go:146] => Receiving config.Message{Text:"1000060144.jpg", Channel:"#irc_channel_name", Username:"<User> ", UserID:"@user:matrix.server.url", Avatar:"https://matrix.server.url:8448/_matrix/media/r0/thumbnail/matrix.server.url/lsPyqCCIqDpyaGzqspGxWcTh?width=37&height=37&method=crop", Account:"matrix.server", Event:"", Protocol:"matrix", Gateway:"irc_matrix_bridge_config", ParentID:"", Timestamp:time.Date(2025, time.January, 9, 18, 43, 31, 213407181, time.Local), ID:"", Extra:map[string][]interface {}{"file":[]interface {}{config.FileInfo{Name:"1000060144.jpg", Data:(*[]uint8)(0x3416e810), Comment:"", URL:"https://matrix.server.url/702fee26/1000060144.jpg", Size:0, Avatar:false, SHA:"702fee26", NativeID:""}}}}
[0548] DEBUG gateway:      [func1:gateway/gateway.go:508] => Send from matrix.server (!rOJIiVJaxBBaGxwDXM:matrix.server.url) to irc.libera (#irc_channel_name) took 46.209µs
[0548] DEBUG irc:          [doSend:bridge/irc/irc.go:262] Sending to channel #irc_channel_name

The download results in a link that points to an invalid image. The contents of that image matterbridge downloads and saves to disk in the media download folder are the same as reported in the opening message: {"errcode":"M_NOT_FOUND","error":"Not found"}. The length of this message coincides with the length 45 received in the log above.
Sending the image in original size or in full size does not matter. Element client connected to the Matrix server sees the image just fine - only matterbridge has trouble accessing it.

The bridge still successfully bridges Telegram and/or Whatsapp, Signal seems to have a problem similar to this, but that's outside the scope of this report. The problem is fairly recent, and appeared end of last month - most likely along the matrix-synapse update that's dated 2024-12-19, so perhaps the Matrix URL schema has changed.

matterbridge version 1.26.0_10 from FreeBSD packages.
py311-matrix-synapse version 1.120.2 from FreeBSD packages

@loviuz
Copy link

loviuz commented Jan 12, 2025

I have the same issue with the bridget between Matrix and Telegram: when I receive a image from Matrix, on Telegram I receive an image with length of 45 bytes with the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants