bolt-js: Bolt App Methods Hanging with `ETIMEDOUT` Warning During `chat.postMessage` Execution
@slack/bolt version
"@slack/bolt": "^3.13.3",
Your App and Receiver Configuration
const receiver = new ExpressReceiver({
signingSecret: process.env.SLACK_SIGNING_SECRET,
port: process.env.SLACK_APP_PORT,
clientId: process.env.SLACK_CLIENT_ID,
clientSecret: process.env.SLACK_CLIENT_SECRET,
stateSecret: "my-state-secret",
scopes: ["chat:write", "chat:write.customize", "im:history", "im:write", "users:read", "users:read.email"],
installerOptions: {
userScopes: ["im:write", "chat:write"]
}
...
})
const app = new App({
receiver,
});
Node.js runtime version
v18.17.1
Expected result:
I’m experiencing VERY slow speeds when using the overall features of my app. I would be expecting fast (if not immediate) responses with my features, which would be a) installing the app / b) opening modals / c) submitting modals / d) sending messages… etc.
I have experienced a very slow functioning of my app with this specific incident: a) I submitted a modal with select options and text inputs. b) The code that is triggered is as follows:
// 1) inserting information to my DB
const relayQueueInsertQuery = `INSERT INTO relay_queue (relay_idx, team_id, user_id, triggered_messages_idx) VALUES (${relayIdx}, '${teamId}', '${relayUser}', ${messageInsertion.insertId});`;
await queryDBWithPool(pool, relayQueueInsertQuery);
// 2) sending a message to user A
await client.chat.postMessage({
channel: relayUser,
...
})
// 3) sending a message to user B
await client.chat.postMessage({
channel: userId,
...
})
// 4) inserting information to my DB
await savePostToDB(postMsg.ts, postMsg.channel, postMsg.message.team, "RELAY_WHALE_CHANNEL");
c) I expect that the above four (1~4) steps to occur immediately, if not within a second or two.
Actual result:
In the above incident, I observed that the 1) first step of inserting into the DB was completed immediately after the modal submission, but the rest steps 2) ~4) were not happening.
It took over a minute for the rest steps to be completed, and it seemed like the app was hanging at the second step, the postMessage method.
After a minute, the rest steps were executed almost simultaneously.
The log showed a [WARN] bolt-app http request failed connect ETIMEDOUT 52.192.46.121:443 warning, which seems to be related to the incident.
Here is the full log:
2024-08-16 21:53:55: [WARN] bolt-app http request failed connect ETIMEDOUT 52.192.46.121:443
The timestamp on the left is the time of when it occurred, and I am in the Asia/Seoul time zone. There were no other error messages left with the above log
Our team has recently raised an issue regarding the axios ETIMEDOUT errors. (#2185)
This has partially been resolved by using the native fetch method instead of using axios, as it seemed to be an error occurring from the axios itself.
However, the warning message that I saw seems to be related to the bolt framework, not axios, since it doesn’t have an axios tag to the warning.
As I commented in the issue, I am experiencing VERY slow functions of my app from time to time, even for modal opens and app installations - as I am getting expired_trigger_id errors as well.
Unfortunately, it doesn’t seem to be appearing in a fixed pattern, and I am not able to reproduce the error (issue) on demand.
Is this also related to how bolt is processing the events with axios? It would be a huge help if you could help us with this issue! This has been bugging our team for around a month already. 😦
Thank you in advance!
Requirements
For general questions/issues about Slack API platform or its server-side, could you submit questions at https://my.slack.com/help/requests/new instead. 🙇
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 20 (7 by maintainers)
FWIW - I’ve been getting the ETIMEDOUT errors when using axios against the slack APIs lately - but only for like the past 3-4 weeks - prior to that, all have been working fine. I have about 13 IPs that seem to be hit with some overlap above.
Hello!
My Slack app running on AWS ECS(region:
ap-northeast-1) has also started to occur this error several times since the beginning of the month of August 2024.😢 It has been in operation for over a year but this error has never occurred before.Seems relieving that it wasn’t just my problem 😃
To answer your questions,
Please let me know if you need any other information! I’d be glad to provide as much as I can.
For ours, it wasn’t a slack issue - someone had dorked up all our routing tables so 1/3 of requests were correct, 1/3 were being routed out of EU, and 1/3 were dead. It was quite a tirade of profanity upon my discovery of this…
@SEEWON and I are also hosting our app in the AWS Tokyo region!
@zimeg New update! I ran into this error with another app that I am running. This time, it occurred during my Axios call of
chat.postMessage.I noticed that the
ETIMEDOUTerror is occurring in all sorts of requests that my apps are sending over to the Slack’s server, including a) POST to webhooks, b) Axios calls ofchat.postMessage, c) calls ofclientmethods within the app. All of the error messages, regardless of the request type and request app, point to the following four IP addresses:35.73.126.78:44335.74.58.174:44352.192.46.121:44352.196.128.139:443the above IPs belong to Slack, in the AWS, Tokyo region - as it was the same IP with the result of
nslookupofhttps://hooks.slack.com.I’m assuming that the ETIMEDOUT errors are originating from the Slack’s servers. Could you look into this?
Really appreciate your help!
@dianexjeong Some experimental changes are on the
web-api-6.x-experimental-axios-adapterbranch if you’re wanting to try this - a few build instructions are in the commit! I’m uncertain how wellfetchworks in all cases but in quick testing it seems fine.~Somehow I was redirected to the actual chat.update page in browser with one attempt, but I was also running two connections to the app~ 🤔 ~Never seen this before!~ Edit: Realized I just clicked a link from the logs 😂
The additional details are super helpful and I can’t think of immediate problems with the setup, but perhaps some logs show something strange in either inbound or outbound requests?