slackapi / slackapi/bolt-js

Slack app won't continue processing unless I change tabs or trigger another action/event on AWS Lambda without a deferred response

Open
#2,630 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:examples auto-triage-skip docs
Dominant language
TypeScript
Stars
2.9k
Forks
445
Avg merge
1d 3h
Merged PRs (30d)
28

Description

I am currently updating our existing slack app to use the new AI App chat features built into slack. Before we were using slash commands. We deploy our slack app as a lambda function in AWS and I have been using the expressReceiver since we use OAuth.

Right now, I am just trying to do the following:

slackApp.event('assistant_thread_started', async ({ event, client, logger }) => {
    try {
        const assistantThread = (event as any).assistant_thread;
        const channel_id: string | undefined = assistantThread?.channel_id;
        const thread_ts: string | undefined = assistantThread?.thread_ts;
        if (!channel_id || !thread_ts) {
            logger.warn('assistant_thread_started missing channel_id or thread_ts');
            return;
        }
        await client.chat.postMessage({
            channel: channel_id,
            thread_ts,
            text: 'How can I assist you?',
        });
    } catch (error) {
        logger.error(error);
    }
});

I was using the Assistant interface and applying that to the slackApp previously but switched to this "lower level" approach to make sure this would work and I run into the same issues.

I am posting here because I am out of ideas. Set up provisioned concurrency and everything and nothing on the AWS/infra side has helped. We did not have these issues when using slash commands as we were using axios to make api calls to send messages to the slack client to the user to avoid this I believe.

When running locally, this works 100% of the time and instantly, but once we deploy the app, opening a new chat with the app does nothing. Once I swap tabs and go back to the chat window, then the message shows up, every time no matter how long I wait.

Same thing seems to happen when actually chatting with the agent as well.

When trying to use setStatus and setTitle to show that the AI is thinking, it doesn't update the chat UI until we change tabs back and forth or send another message. Basically any action that triggers the slack app again.

We are using bolt js 4.4.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the expressReceiver and the assistant_thread_started handler in the Bolt JS 4.4.0 app, then reproduce the behavior in the deployed AWS Lambda environment rather than locally. Compare when the handler response, chat.postMessage, setStatus, and setTitle become visible in Slack; done means deployed assistant chats update without a tab change or another app event.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, express, typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.