You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I’m making a slack app with bolt-js, node.js and slack apis.
I've set up OAuth2 authorization, and my app configuration is as follows:
constapp=newApp({signingSecret: process.env.SLACK_SIGNING_SECRET,socketMode: false,port: 3000,clientId: process.env.SLACK_CLIENT_ID,clientSecret: process.env.SLACK_CLIENT_SECRET,stateSecret: "my-state-secret",scopes: ["channels:history"// ... and so on],installationStore: {// emitted the installationStore code herestoreInstallation: {},fetchInstallation: {},deleteInstallation: {}},});
I’ve set up a Jenkins CI/CD pipeline with PM2 to deploy node.js to AWS EC2, but I’m encountering some EADDRINUSE issues in the pm2 reloading step.
There are two cores in the EC2 instance, and therefore there are two runs when I run it in PM2 cluster mode.
When I run the pm2 start ecosystem.config.js command, it runs fine - no port already in use error.
But when I reload the pm2 with pm2 reload, the following error shows:
Error: listen EADDRINUSE: address already in use :::3000
at Server.setupListenHandle [as _listen2] (node:net:1740:16)
at listenInCluster (node:net:1788:12)
at Server.listen (node:net:1876:7)
at /var/lib/jenkins/workspace/Babywhale-CICD-Pipeline/node_modules/@slack/bolt/dist/receivers/HTTPReceiver.js:177:25
at new Promise (<anonymous>)
at HTTPReceiver.start (/var/lib/jenkins/workspace/Babywhale-CICD-Pipeline/node_modules/@slack/bolt/dist/receivers/HTTPReceiver.js:143:16)
at App.start (/var/lib/jenkins/workspace/Babywhale-CICD-Pipeline/node_modules/@slack/bolt/dist/App.js:241:30)
at /var/lib/jenkins/workspace/Babywhale-CICD-Pipeline/app.js:320:13
at Object.<anonymous> (/var/lib/jenkins/workspace/Babywhale-CICD-Pipeline/app.js:322:3)
at Module._compile (node:internal/modules/cjs/loader:1256:14) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '::',
port: 3000
It says that my port 3000 is already in use and reloads three more times by itself, and eventually the error disappears and my slack app works fine.
Why is the port conflicts happening?
Is bolt-js not compatible with AWS EC2 deployment?
Should I erase the port option in the app configuration part?
Is there a possible workaround with the port conflict issue?
Any help would be very appreciated. Thank you in advance!
which is just normal reloading and running of the bolt slack app
Actual result:
which goes through the address already in use error, and proceeds to reload three more times, eventually making it to successfully run the bolt app
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. 🙇
I am not familiar with pm2 reload command, but according to their document, it seems that the command does not terminate the running process when reloading, and probably it tries to start a new one with the same settings: https://pm2.keymetrics.io/docs/usage/cluster-mode/#reload That's why multiple processes try to listen on the same port. I haven't checked how pm2 restart works but trying a different command for the same purpose (I mean live reloading for local development) may help.
Hello,
I’m making a slack app with bolt-js, node.js and slack apis.
I've set up OAuth2 authorization, and my app configuration is as follows:
I’ve set up a Jenkins CI/CD pipeline with PM2 to deploy node.js to AWS EC2, but I’m encountering some
EADDRINUSE
issues in the pm2 reloading step.There are two cores in the EC2 instance, and therefore there are two runs when I run it in PM2 cluster mode.
The following is my
ecosystem.config.js
:When I run the
pm2 start ecosystem.config.js
command, it runs fine - noport already in use
error.But when I reload the pm2 with
pm2 reload
, the following error shows:It says that my port 3000 is already in use and reloads three more times by itself, and eventually the error disappears and my slack app works fine.
Why is the port conflicts happening?
port
option in the app configuration part?Is there a possible workaround with the port conflict issue?
Any help would be very appreciated. Thank you in advance!
Reproducible in:
The Slack SDK version
Node.js runtime version
OS info
Steps to reproduce:
(Share the commands to run, source code, and project settings)
Expected result:
which is just normal reloading and running of the bolt slack app
Actual result:
which goes through the
address already in use
error, and proceeds to reload three more times, eventually making it to successfully run the bolt appRequirements
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.
The text was updated successfully, but these errors were encountered: