matrix-org / matrix-appservice-discord

A bridge between Matrix and Discord.
Apache License 2.0
804 stars 152 forks source link

Media are not bridged when used with a Dendrite homeserver #839

Open tux93 opened 2 years ago

tux93 commented 2 years ago

Describe the bug When Bridging a Discord Channel to a Matrix Room on a Dendrite homeserver Images are not bridged. Discord puppets on Matrix don't get an Avatar image.

To Reproduce Steps to reproduce the behavior:

  1. Bridge a Discord channel to a Matrix room on a Dendrite homeserver
  2. Send an image on Matrix -> The Image never arrives on Discord
  3. Send an image on Discord -> The image never arrives on Matrix
  4. Puppets of Discord Users on Matrix do not get their respective Avatar images

Expected behavior Images are bridged between Discord and MAtrix in both directions. Discord puppets on Matrix show the Discord Users Avatar image.

Desktop (please complete the following information):

Additional context Debug log output when sending an Image on Matrix:

Aug-28 18:40:07.218 [bot-sdkAppservice] info: [ 'Processing transaction 1106' ]
Aug-28 18:40:07.219 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Aug-28 18:40:07.227 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [28/Aug/2022:16:40:07 +0000] "PUT /transactions/1106?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Go-http-client/1.1"\n'
]
Aug-28 18:40:07.431 [MatrixEventProcessor] warn: There was an error sending a matrix event Failed to download. Error: Parse Error: Missing expected CR after header value

Message Source:

{
  "content": {
    "body": "picrew_62961.jpg",
    "info": {
      "h": 518,
      "mimetype": "image/jpeg",
      "size": 180475,
      "thumbnail_info": {
        "h": 518,
        "mimetype": "image/jpeg",
        "size": 123378,
        "w": 518
      },
      "thumbnail_url": "mxc://squirrel.rocks/dea19da21c81a09ace22759b7ee928857956235ecf168f645a9199c97eca5119",
      "w": 518,
      "xyz.amorgan.blurhash": "UBKcww},DN%4}hxV.8M|X3xbt.V@~UWB9Hbc"
    },
    "msgtype": "m.image",
    "url": "mxc://squirrel.rocks/5dfc4ca2cff69713c5e6396242058cdcd6d3102b132cc6db0acae4b32c6a4561"
  },
  "event_id": "$Hcj2Bo5jxBwGqEJF4Hxpvy9SMZZ5qsy7cmxMztVDUC0",
  "origin_server_ts": 1661704807067,
  "sender": "@fl4nn:squirrel.rocks",
  "type": "m.room.message",
  "unsigned": {
    "transaction_id": "m1661704806877.50"
  },
  "room_id": "!UBlEqS84wXbOltCN:squirrel.rocks"
}

Debug log output when sending an Image on Discord:

Aug-28 18:43:11.526 [bot-sdkMatrixHttpClient] error: [
  '(REQ-219)',
  Error: Parse Error: Missing expected CR after header value
      at TLSSocket.socketOnData (node:_http_client:494:22)
      at TLSSocket.emit (node:events:527:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
    bytesParsed: 628,
    code: 'HPE_CR_EXPECTED',
    reason: 'Missing expected CR after header value',
    rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 53 75 6e 2c 20 ... 895 more bytes>
  }
]
Aug-28 18:43:11.528 [UserSync] error: Failed to update user's profile Error: Parse Error: Missing expected CR after header value
    at TLSSocket.socketOnData (node:_http_client:494:22)
    at TLSSocket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  bytesParsed: 628,
  code: 'HPE_CR_EXPECTED',
  reason: 'Missing expected CR after header value',
  rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 53 75 6e 2c 20 ... 895 more bytes>
}
Aug-28 18:43:11.548 [bot-sdkAppservice] info: [ 'Processing transaction 1108' ]
Aug-28 18:43:11.549 [bot-sdkAppservice] info: [ 'Processing event of type m.room.member' ]
Aug-28 18:43:11.677 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [28/Aug/2022:16:43:11 +0000] "PUT /transactions/1108?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Go-http-client/1.1"\n'
]
Aug-28 18:43:12.087 [bot-sdkMatrixHttpClient] error: [
  '(REQ-221)',
  Error: Parse Error: Missing expected CR after header value
      at TLSSocket.socketOnData (node:_http_client:494:22)
      at TLSSocket.emit (node:events:527:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
    bytesParsed: 628,
    code: 'HPE_CR_EXPECTED',
    reason: 'Missing expected CR after header value',
    rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 53 75 6e 2c 20 ... 895 more bytes>
  }
]

Debug log output when the Bridge tries to update a puppet profile:

Aug-28 18:40:07.218 [bot-sdkAppservice] info: [ 'Processing transaction 1106' ]
Aug-28 18:40:07.219 [bot-sdkAppservice] info: [ 'Processing event of type m.room.message' ]
Aug-28 18:40:07.227 [bot-sdkAppservice] info: [
  '127.0.0.1 - - [28/Aug/2022:16:40:07 +0000] "PUT /transactions/1106?access_token=%3Credacted%3E HTTP/1.1" 200 2 "-" "Go-http-client/1.1"\n'
]
Aug-28 18:40:07.431 [MatrixEventProcessor] warn: There was an error sending a matrix event Failed to download. Error: Parse Error: Missing expected CR after header value
Aug-28 18:43:11.526 [bot-sdkMatrixHttpClient] error: [
  '(REQ-219)',
  Error: Parse Error: Missing expected CR after header value
      at TLSSocket.socketOnData (node:_http_client:494:22)
      at TLSSocket.emit (node:events:527:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
      at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
    bytesParsed: 628,
    code: 'HPE_CR_EXPECTED',
    reason: 'Missing expected CR after header value',
    rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 53 75 6e 2c 20 ... 895 more bytes>
  } 
] 
Aug-28 18:43:11.528 [UserSync] error: Failed to update user's profile Error: Parse Error: Missing expected CR after header value
    at TLSSocket.socketOnData (node:_http_client:494:22)
    at TLSSocket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
    at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
  bytesParsed: 628,
  code: 'HPE_CR_EXPECTED',
  reason: 'Missing expected CR after header value',
  rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 53 75 6e 2c 20 ... 895 more bytes>
}
Miepee commented 2 years ago

Discord puppets on Matrix don't get an Avatar image.

Sounds like #788 Does applying #792 fix that for you?

tux93 commented 2 years ago

Discord puppets on Matrix don't get an Avatar image.

Sounds like #788 Does applying #792 fix that for you?

No, User Profile updates still fail with this error:

Sep 02 11:51:52 node[18728]: Sep-2 11:51:52.460 [UserSync] error: Failed to update user's profile Error: Parse Error: Missing expected CR after header value
Sep 02 11:51:52 node[18728]:     at TLSSocket.socketOnData (node:_http_client:494:22)
Sep 02 11:51:52 node[18728]:     at TLSSocket.emit (node:events:527:28)
Sep 02 11:51:52 node[18728]:     at addChunk (node:internal/streams/readable:315:12)
Sep 02 11:51:52 node[18728]:     at readableAddChunk (node:internal/streams/readable:289:9)
Sep 02 11:51:52 node[18728]:     at TLSSocket.Readable.push (node:internal/streams/readable:228:10)
Sep 02 11:51:52 node[18728]:     at TLSWrap.onStreamRead (node:internal/stream_base_commons:190:23) {
Sep 02 11:51:52 node[18728]:   bytesParsed: 628,
Sep 02 11:51:52 node[18728]:   code: 'HPE_CR_EXPECTED',
Sep 02 11:51:52 node[18728]:   reason: 'Missing expected CR after header value',
Sep 02 11:51:52 node[18728]:   rawPacket: <Buffer 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d 0a 53 65 72 76 65 72 3a 20 6e 67 69 6e 78 2f 31 2e 32 31 2e 35 0d 0a 44 61 74 65 3a 20 46 72 69 2c 20 ... 895 more
 bytes>
Sep 02 11:51:52 node[18728]: }
Miepee commented 2 years ago

Ah well. So a different issue then.