question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Trigger Id Expired--Socket Mode

See original GitHub issue

I want to open a modal (a dropdown menu) in socket mode using the slash command and collect the data that users enter. However, no matter what I do, I keep getting a “trigger_id expired” error when I run the slash command. Sometimes the command will work the first time and open up the menu, but the second time I run the command it will say trigger_id expired. At first I thought this was because it was taking more than 3 seconds for my modal to open, but then I simplified the view a lot just to test this and got the same error. I also tried to follow this example (in case it is just a timeout issue): https://github.com/slackapi/node-slack-sdk/issues/1131 but it might be helpful if you could post what this would look like in python if possible. Thank you!

The slack_bolt version

slack-sdk==3.5.0 slack-bolt==1.5.0

Python runtime version

python==2.7.16

OS info

ProductName: Mac OS X ProductVersion: 10.15.7 BuildVersion: 19H524 Darwin Kernel Version 19.6.0

Steps to reproduce:

  1. Use socket mode
  2. Have the following listener
app.command("/mycommand")
def open_modal(ack, body, client):
  ack()
  client.views_open(
    # Pass a valid trigger_id within 3 seconds of receiving it
    trigger_id=body["trigger_id"],
    # View payload
    view= {
      "type": "modal",
      "title": {
        "type": "plain_text",
        ....}
})

Expected result:

The modal to open

Actual result:

Slack says dispatch_failed and I get the error: The server responded with:

{'ok': False, 'error': 'invalid_arguments', 'response_metadata': {'messages': ['[ERROR] `trigger_id` expired [json-pointer:/trigger_id]']}}

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Apr 28, 2021

@mariebarrramsey

Also, the debugger says DEBUG:slack_bolt.App:on_message invoked: (message: {“type”:“hello”,“num_connections”:5,… I’m not sure what the num_connections is for or if this is related

This indicates that your app has other active connections at the moment. If you are not sure where the other connections live, I would recommend trying the following steps:

  • Create a new app-level token with connections:write
  • Switch to the new token for the connection you’re currently working on
  • Revoke the existing app-level token that can be used by other connections

You can configure app-level tokens at Settings > Basic Information > App-Level Tokens section.

0reactions
mariebarrramseycommented, Apr 28, 2021

Wow that was the problem!! Thank you so much! I have no idea how those other connections happened. All I can think is maybe some process was still running in the background or never got properly terminated.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Slack bolt: trigger_id expired when trying to trigger app.client ...
In my local Slack bot, I am having this issue with instantiating a command: export const createTicketCommand = (app: App): Middleware< ...
Read more >
Handling user interaction in your Slack apps
Triggers expire in three seconds. Use them before you lose them. You'll receive a trigger_expired error when using a method with an expired...
Read more >
Bolt for Python - Slack Platform Developer Tools
With Socket Mode, instead of creating a server with endpoints that Slack sends payloads too, the app will instead connect to Slack via...
Read more >
Client API - Socket.IO
socket.id​. (String). A unique identifier for the socket session. Set after the connect event is triggered, and updated after the reconnect ...
Read more >
Kafka Broker Configurations for Confluent Platform
This setting also influences producer id expiration - producer ids are expired once this time has elapsed after the last write with the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found