Set X-Slack-No-Retry header during Slack timeout
When using the webclient through AWS API gateway, there are often delays which cause slack to return "X-Slack-Retry-Reason"=>"http_timeout" even though the POST has been made successfully (the bot writes to slack).
Is there a way to set the X-Slack-No-Retry: 1 on the webclient config in order to prevent the bot attempting the same call multiple times even though successful?
The connection is setup here for the web client. It's private. We don't seem to expose arbitrary headers or a connection editing mechanism.
Try client.send(:connection).headers['X-Slack-No-Retry'] = 1 as a workaround?
I'd like this implemented properly if you want to give it a stab. I suggest exposing the entire connection object.
Slack::Web::Client.configure do |config|
config.connection do |c|
c.use Faraday::Request::OAuth # yields during connection creation
end
# or
config.connection.headers[...] = ...
end
For the specific X-Slack-Retry-Reason error I would also appreciate a custom exception like we do for rate limiting.