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

Slack Messages with URL Preview are not sent to Matrix #774

Open
samuel-p opened this issue Feb 28, 2024 · 2 comments
Open

Slack Messages with URL Preview are not sent to Matrix #774

samuel-p opened this issue Feb 28, 2024 · 2 comments

Comments

@samuel-p
Copy link

We are running our own slack bridge, but messages sent from Slack, that contain a URL, which generates a preview are not sent to the Matrix room. We enabled Debug Logs on the Bridge and on Synapse itself, but could not find any error messages. Instead it seems, that the message is somehow filtered by the bridge.

slack-bridge-1  | DEBUG 09:05:58:577 [SlackEventHandler] Received slack event: {
slack-bridge-1  |   type: 'message',
slack-bridge-1  |   channel: 'CHANNEL_ID_REDACTED',
slack-bridge-1  |   text: 'A test message: <https://www.repubblica.it/>',
slack-bridge-1  |   blocks: [ { type: 'rich_text', block_id: 'uIFeC', elements: [Array] } ],
slack-bridge-1  |   user: 'SLACK_USER_ID_REDACTED',
slack-bridge-1  |   client_msg_id: '695c96d3-87c9-4397-bef0-acb07a5cd4f6',
slack-bridge-1  |   team: 'TEAM_ID_REDACTED',
slack-bridge-1  |   source_team: 'TEAM_ID_REDACTED',
slack-bridge-1  |   user_team: 'TEAM_ID_REDACTED',
slack-bridge-1  |   suppress_notification: false,
slack-bridge-1  |   event_ts: '1709111158.458299',
slack-bridge-1  |   ts: '1709111158.458299'
slack-bridge-1  | } TEAM_ID_REDACTED
synapse-1       | 2024-02-28 10:05:58,578 - synapse.media.url_previewer - 743 - DEBUG - expire_url_cache_data-4773 - Running url preview cache expiry
synapse-1       | 2024-02-28 10:05:58,579 - synapse.storage.txn - 759 - DEBUG - expire_url_cache_data-4773 - [TXN START] {get_expired_url_cache-103c7}
synapse-1       | 2024-02-28 10:05:58,579 - synapse.storage.txn - 863 - DEBUG - expire_url_cache_data-4773 - [TXN END] {get_expired_url_cache-103c7} 0.000933 sec
synapse-1       | 2024-02-28 10:05:58,580 - synapse.media.url_previewer - 798 - DEBUG - expire_url_cache_data-4773 - No entries removed from url preview cache
synapse-1       | 2024-02-28 10:05:58,580 - synapse.storage.txn - 759 - DEBUG - expire_url_cache_data-4773 - [TXN START] {get_url_cache_media_before-103c8}
synapse-1       | 2024-02-28 10:05:58,581 - synapse.storage.txn - 863 - DEBUG - expire_url_cache_data-4773 - [TXN END] {get_url_cache_media_before-103c8} 0.000688 sec
synapse-1       | 2024-02-28 10:05:58,581 - synapse.media.url_previewer - 846 - DEBUG - expire_url_cache_data-4773 - No media removed from url preview cache
synapse-1       | 2024-02-28 10:05:58,697 - synapse.storage.TIME - 665 - DEBUG - sentinel - Total database time: 0.046% {_prune_old_user_ips(2): 0.023%, get_expired_url_cache(1): 0.009%, _reap_stale_read_write_locks(1): 0.007%}
slack-bridge-1  | DEBUG 09:05:58:778 [SlackEventHandler] Received slack event: {
slack-bridge-1  |   type: 'message',
slack-bridge-1  |   subtype: 'message_changed',
slack-bridge-1  |   message: {
slack-bridge-1  |     client_msg_id: '695c96d3-87c9-4397-bef0-acb07a5cd4f6',
slack-bridge-1  |     type: 'message',
slack-bridge-1  |     text: 'A test message: <https://www.repubblica.it/>',
slack-bridge-1  |     user: 'SLACK_USER_ID_REDACTED',
slack-bridge-1  |     blocks: [ [Object] ],
slack-bridge-1  |     team: 'TEAM_ID_REDACTED',
slack-bridge-1  |     attachments: [ [Object] ],
slack-bridge-1  |     ts: '1709111158.458299'
slack-bridge-1  |   },
slack-bridge-1  |   previous_message: {
slack-bridge-1  |     client_msg_id: '695c96d3-87c9-4397-bef0-acb07a5cd4f6',
slack-bridge-1  |     type: 'message',
slack-bridge-1  |     text: 'A test message: <https://www.repubblica.it/>',
slack-bridge-1  |     user: 'SLACK_USER_ID_REDACTED',
slack-bridge-1  |     ts: '1709111158.458299',
slack-bridge-1  |     blocks: [ [Object] ],
slack-bridge-1  |     team: 'TEAM_ID_REDACTED'
slack-bridge-1  |   },
slack-bridge-1  |   channel: 'CHANNEL_ID_REDACTED',
slack-bridge-1  |   hidden: true,
slack-bridge-1  |   ts: '1709111158.458299',
slack-bridge-1  |   event_ts: '1709111158.002100'
slack-bridge-1  | } TEAM_ID_REDACTED
slack-bridge-1  | DEBUG 09:05:58:780 [SlackGhostStore] Getting existing ghost from cache for @_slack_scionproto_SLACK_USER_ID_REDACTED:matrix.scion.org
slack-bridge-1  | INFO 09:05:58:781 [SlackGhost] Updating user information for SLACK_USER_ID_REDACTED
slack-bridge-1  | DEBUG 09:05:58:781 [SlackGhost] Using fresh userInfo for SLACK_USER_ID_REDACTED
slack-bridge-1  | DEBUG 09:05:58:782 [slack-api] apiCall('users.info') start
slack-bridge-1  | DEBUG 09:05:58:782 [slack-api] will perform http request
slack-bridge-1  | DEBUG 09:05:58:925 [slack-api] http response received
slack-bridge-1  | DEBUG 09:05:58:926 [SlackGhost] Ensuring displayname SLACK_DISPLAYNAME_REDACTED for SLACK_USER_ID_REDACTED
slack-bridge-1  | DEBUG 09:05:58:927 [Intent] Checking if user @_slack_scionproto_SLACK_USER_ID_REDACTED:matrix.scion.org is registered
slack-bridge-1  | DEBUG 09:05:58:927 [Intent] ensureRegistered: already registered
slack-bridge-1  | DEBUG 09:05:58:928 [MatrixHttpClient] (REQ-1017) GET http://synapse:8008/_matrix/client/v3/profile/%40_slack_scionproto_SLACK_USER_ID_REDACTED%3Amatrix.scion.org
synapse-1       | 2024-02-28 10:05:58,931 - synapse.access.http.8008 - 427 - DEBUG - GET-12743 - ::ffff:172.18.144.2 - 8008 - Received request: GET /_matrix/client/v3/profile/%40_slack_scionproto_SLACK_USER_ID_REDACTED%3Amatrix.scion.org?user_id=%40_slack_scionproto_SLACK_USER_ID_REDACTED%3Amatrix.scion.org
synapse-1       | 2024-02-28 10:05:58,932 - synapse.storage.txn - 759 - DEBUG - GET-12743 - [TXN START] {get_profile_displayname-103c9}
synapse-1       | 2024-02-28 10:05:58,932 - synapse.storage.txn - 863 - DEBUG - GET-12743 - [TXN END] {get_profile_displayname-103c9} 0.000721 sec
synapse-1       | 2024-02-28 10:05:58,933 - synapse.storage.txn - 759 - DEBUG - GET-12743 - [TXN START] {get_profile_avatar_url-103ca}
synapse-1       | 2024-02-28 10:05:58,934 - synapse.storage.txn - 863 - DEBUG - GET-12743 - [TXN END] {get_profile_avatar_url-103ca} 0.000872 sec
synapse-1       | 2024-02-28 10:05:58,935 - synapse.access.http.8008 - 472 - INFO - GET-12743 - ::ffff:172.18.144.2 - 8008 - {None} Processed request: 0.004sec/0.000sec (0.002sec, 0.000sec) (0.001sec/0.002sec/2) 98B 200 "GET /_matrix/client/v3/profile/%40_slack_scionproto_SLACK_USER_ID_REDACTED%3Amatrix.scion.org?user_id=%40_slack_scionproto_SLACK_USER_ID_REDACTED%3Amatrix.scion.org HTTP/1.1" "-" [0 dbevts]
slack-bridge-1  | DEBUG 09:05:58:937 [PgDatastore] upsertUser: @_slack_scionproto_SLACK_USER_ID_REDACTED:matrix.scion.org
slack-bridge-1  | DEBUG 09:05:58:943 [SlackGhost] Using cached userInfo for SLACK_USER_ID_REDACTED
slack-bridge-1  | DEBUG 09:05:58:943 [SlackGhost] Completed update for SLACK_USER_ID_REDACTED in 162ms
slack-bridge-1  | DEBUG 09:05:58:946 [BridgedRoom] Recent message key add: 1709111158.458299
slack-bridge-1  | DEBUG 09:05:58:947 [substitutions] running substitutions on  A test message: <https://www.repubblica.it/>
slack-bridge-1  | DEBUG 09:05:58:948 [substitutions] running substitutions on  A test message: <https://www.repubblica.it/>
slack-bridge-1  | DEBUG 09:05:58:948 [substitutions] running substitutions on  A test message: <https://www.repubblica.it/>
slack-bridge-1  | DEBUG 09:05:58:948 [BridgedRoom] Ignoring edit message because messages are the same post-substitutions.
@tadzik
Copy link
Collaborator

tadzik commented Mar 29, 2024

I tried to reproduce it and cannot; messages with link previews come through, in both RTM and webhook mode.

The message would get quietly dropped by the bridge if it was sent by the same Slack bot that's doing the bridge – can you confirm that this is not the case? It is broken for all users in that channel? And, just in case, do other messages in that channel come through?

@nicorusti
Copy link

nicorusti commented Apr 3, 2024

Thank you for looking into this @tadzik! I was debugging this together with @samuel-p and I was the one who did the test above.

The message would get quietly dropped by the bridge if it was sent by the same Slack bot that's doing the bridge – can you confirm that this is not the case?

I was sending the message with my own Slack user, the one that shows in logs as SLACK_USER_ID_REDACTED, not a bot user.

It is broken for all users in that channel?

Yes, we experience this both in a large public channel, and in a test channel that we set up to troubleshoot this.

And, just in case, do other messages in that channel come through?

Yes, other messages that do not have a preview in Slack also come through.

Are there any other logs that we could provide beyond the ones above?

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

No branches or pull requests

3 participants