Sometimes, Slack message can fail to send, e.g. if the bot isn't in the channel it's trying to send messages to.
Having some try/catch blocks around the two chat_postMessage calls in nephthys/events/message.py would be nice. It should send an error to the heartbeats channel, continue with the other create-ticket actions, and of course make sure the ERROR is still logged.
Example of an error:
2025-11-15T15:54:25.234503101Z ERROR:slack_bolt.AsyncApp:Failed to run listener function (error: The request to the Slack API failed. (url: https://slack.com/api/chat.postMessage, status: 200)
2025-11-15T15:54:25.234545571Z The server responded with: {'ok': False, 'error': 'channel_not_found'})
2025-11-15T15:54:25.234549990Z Traceback (most recent call last):
2025-11-15T15:54:25.234574556Z ^
2025-11-15T15:54:25.234577181Z File "/app/nephthys/utils/slack.py", line 40, in handle_message
2025-11-15T15:54:25.234580016Z await on_message(event, client)
2025-11-15T15:54:25.234582681Z File "/app/nephthys/events/message.py", line 342, in on_message
2025-11-15T15:54:25.234585386Z await handle_new_question(event, client, db_user)
2025-11-15T15:54:25.234587931Z File "/app/nephthys/events/message.py", line 182, in handle_new_question
2025-11-15T15:54:25.234590686Z ticket_message = await send_ticket_message(
2025-11-15T15:54:25.234593261Z ^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-15T15:54:25.234595876Z ...<5 lines>...
2025-11-15T15:54:25.234598601Z )
2025-11-15T15:54:25.234601195Z ^
2025-11-15T15:54:25.234603640Z File "/app/nephthys/events/message.py", line 94, in send_ticket_message
2025-11-15T15:54:25.234606435Z return await client.chat_postMessage(
2025-11-15T15:54:25.234608950Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-11-15T15:54:25.234611615Z ...<27 lines>...
2025-11-15T15:54:25.234614280Z )
2025-11-15T15:54:25.234616735Z ^
2025-11-15T15:54:25.234648655Z File "/app/.venv/lib/python3.13/site-packages/slack_sdk/web/async_base_client.py", line 215, in _send
2025-11-15T15:54:25.234651540Z return AsyncSlackResponse(**{**data, **res}).validate()
2025-11-15T15:54:25.234654125Z ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
2025-11-15T15:54:25.234657792Z File "/app/.venv/lib/python3.13/site-packages/slack_sdk/web/async_slack_response.py", line 203, in validate
2025-11-15T15:54:25.234660587Z raise e.SlackApiError(message=msg, response=self)
2025-11-15T15:54:25.234663232Z slack_sdk.errors.SlackApiError: The request to the Slack API failed. (url: https://slack.com/api/chat.postMessage, status: 200)
(This is pretty low-priority)
Sometimes, Slack message can fail to send, e.g. if the bot isn't in the channel it's trying to send messages to.
Having some try/catch blocks around the two
chat_postMessagecalls innephthys/events/message.pywould be nice. It should send an error to the heartbeats channel, continue with the other create-ticket actions, and of course make sure the ERROR is still logged.Example of an error:
(This is pretty low-priority)