mautrix / meta

A Matrix-Facebook Messenger and Instagram DM puppeting bridge.
GNU Affero General Public License v3.0
178 stars 12 forks source link

Failure to upload image to FB Messenger #53

Closed alexmaras closed 7 months ago

alexmaras commented 7 months ago

Sending photos in FB Messenger has been failing with the following message:

 Your message may not have been bridged: failed to upload attachment: fbid not received

From the logs:

Apr 24 12:21:52 atlas matrix-reloaded_bridge-meta_1[27134]: 2024-04-24T04:21:52Z WRN No fbid received for upload action="handle matrix event" event_id=$hDhOJWcRPLTyRVvG3g1B8EHmkwz1hCwCcCDXCDR900M event_type=m.room.message response={"__ar":1,"dtsgToken":"NAcO8pp2z3GiMf01LrAajm0_9YmtXRymOZ_Nyjh9_xbwrMxXSXQr2AA:11:1710329737","lid":"7361284086991797096","payload":{"metadata":{"0":{"fbid":412640354853594,"filename":"1000025656.jpg","filetype":"image/jpeg","image_id":412640354853594,"src":"https://scontent.fper11-1.fna.fbcdn.net/v/t1.15752-9/435128500_1747742349052957_311666362089642159_n.jpg?_nc_cat=102\u0026ccb=1-7\u0026_nc_sid=5f2048\u0026_nc_ohc=XuGknekTfcUAb6XOWSb\u0026_nc_ht=scontent.fper11-1.fna\u0026oh=03_Q7cD1QEGkPiWlXhmq-P_0FQB-FkctUCcM5DNA6cLoCGaTWrROQ\u0026oe=664FFE54"}},"uploadID":null}} room_id=!HXapaLKNFEXfapGIYO:nop.chat thread_id=2404118289665795
Apr 24 12:21:52 atlas matrix-reloaded_bridge-meta_1[27134]: 2024-04-24T04:21:52Z ERR Failed to convert message error="failed to upload attachment: fbid not received" action="handle matrix event" event_id=$hDhOJWcRPLTyRVvG3g1B8EHmkwz1hCwCcCDXCDR900M event_type=m.room.message room_id=!HXapaLKNFEXfapGIYO:nop.chat thread_id=2404118289665795
Apr 24 12:21:52 atlas matrix-reloaded_bridge-meta_1[27134]: 2024-04-24T04:21:52Z ERR Sending message metrics for event error="failed to upload attachment: fbid not received" event_id=$hDhOJWcRPLTyRVvG3g1B8EHmkwz1hCwCcCDXCDR900M event_type=m.room.message handling_step="Error converting" room_id=!HXapaLKNFEXfapGIYO:nop.chat sender=@coolbug:nop.chat thread_id=2404118289665795

Looks like the upload to the servers works ok, but over at https://github.com/mautrix/meta/blob/9ab9bb08a402653f3880a72aff14311e65bb4699/msgconv/from-matrix.go#L78C2-L78C54 the FB ID isn't pulled out of the JSON response. In this case it seems like it should have been able to get 412640354853594 assuming that's the right ID