Sunday 31 October 2021

Slack Slash commands error: failed with the error "operation_timeout"

I am using Slack Slash commands to send requests to my AWS Lambda python app.

However, after sending the command, Slack is returning the message failed with the error "operation_timeout":

operation_timeout

Even though I received this message, my request is sent successfully, and the job is done.

I just want to know how to get rid of this message sent by slack.

I know that Slack expects an HTTP POST 200 OK as acknowledgement response as from this link here but I did send one the moment the payload is received as shown here:

lambda_handler.py

def slack_acknowledgment_response(resonse_url):

    # Make API Call to Slack API
    requests.post(
        resonse_url, 
        {'text': 'Test'}
    )


# This is my main event
def main(event, context):

    payload = parse_qs(event['postBody'])

    response_url = payload['response_url'][0]

    slack_acknowledgment_response(response_url)

    time.sleep(5)

I intentionally added a sleep period of 5 seconds because I get this error if the runtime of my script takes longer than 3 seconds, even though I already sent an acknowledgement before 3 seconds.

Can someone please help out ?



from Slack Slash commands error: failed with the error "operation_timeout"

No comments:

Post a Comment