bolt-js: Bolt Api's `client` methods are unresponsive
Description
Hello I am running into a problem that is preventing my slackbot from responding to slack commands.
To give a bit of background, I am using Javascript Bolt API combined with ExpressReceiver to deploy my app via Aws Lambda.
Although I set up the installation store properly for my ExpressReceiver as instructed, when I try to use app.command
is seems that the client
methods don’t work. For example, upon calling the client.conversations.join
, the app just hangs. I checked the logs and there are no error, it just hangs…
Here’s my code for reference:
const { App, ExpressReceiver, LogLevel } = require("@slack/bolt");
const serverlessExpress = require("@vendia/serverless-express");
const expressReceiver = new ExpressReceiver({
signingSecret: process.env.SLACK_SIGNING_SECRET,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: "my-secret",
scopes: [
"chat:write",
"commands",
"channels:join",
"channels:history",
"chat:write",
"chat:write.public",
"groups:history",
"im:history",
"mpim:history",
"reactions:write",
],
installationStore: {
// I do all the proper setting, fetching, and deletion to my database here
},
});
const app = new App({
receiver: expressReceiver,
processBeforeResponse: true,
logLevel: LogLevel.DEBUG,
installerOptions: {
directInstall: true,
},
});
app.command("/partypoll", async ({ ack, say, body, client }) => {
console.log("got to /partypoll", ack, say, body, client);
await ack();
// Code execution hangs after the following line
await client.conversations.join({ channel: body.channel_id });
// Further logic here to create polls goes here, but code execution never reaches this point
})
module.exports.handler = serverlessExpress({
app: expressReceiver.app,
});
Do you happen to know the best way to get through this hanging behavior so I can properly make my slack app respond to commands successfully?
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- I’ve read and agree to the Code of Conduct.
- I’ve searched for any related issues and avoided creating a duplicate issue.
Bug Report
Reproducible in:
package version:
{
"name": "party-poll-v2",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"@slack/bolt": "^3.12.1",
"@slack/oauth": "^2.5.4",
"@vendia/serverless-express": "^4.10.1",
"axios": "^1.1.3",
"querystring": "^0.2.1"
},
"devDependencies": {
"serverless-dotenv-plugin": "^4.0.2",
"serverless-offline": "^10.0.2"
}
}
node version:
v14.20.1
OS version(s):
macOS Big Sur 11.6.8 (20G730)
Steps to reproduce:
- To to slackbot website
- Select “Add to Slack”
- Authorize
- Try running a party poll command, i.e.
/partypoll "What is your favorite color?" red blue green
Expected result:
User sees slackbot respond and post a poll as a message to the channel
Actual result:
User’s command disappears. The slackbot is unresponsive. To the user, it appears as if nothing happened.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (8 by maintainers)
@hello-ashleyintech thanks so much for your help. I will close now and keep you posted on my findings 🙂
Thank you @hello-ashleyintech. An update on my end which is good news and bad news.
The good news is that the slackbot successfully responded to my slash command 🎉
The bad news is that the response took very long, roughly 5 or 10 minutes after issuing the command. I will look into reasons for this level of latency but I will try to figure out if this is a problem with AWS or a problem on Slack’s end.