-
Notifications
You must be signed in to change notification settings - Fork 399
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to shutdown the HTTP server for OAuth flow, when using sockets + customRoutes #1368
Comments
@sbcgua - I agree that assuming that I'm curious though how using your customRoutes in your use case led to you seeing this logging output and identifying the missing logic. Could you elaborate on your setup? |
Honestly speaking I didn't debug it through to explain the reason in detail but here is the code sample: // imports ... and env validation
const app = new App({
signingSecret: process.env.SLACK_SIGNING_SECRET,
token: process.env.SLACK_BOT_TOKEN,
socketMode: true,
appToken: process.env.SLACK_APP_TOKEN,
logLevel,
// customRoutes: [{
// path: '/health-check',
// method: ['GET'],
// handler: (req, res) => {
// res.writeHead(200);
// res.end('OK');
// },
// }],
});
app.message(async (payload) => {
...
});
async function shutdown() {
const timeout = setTimeout(() => {
console.error('Stop server timed out, force exit');
process.exit(1);
}, 3000);
console.log('Stopping server ...');
await app.stop();
clearTimeout(timeout);
process.exit(0);
}
process.on('SIGTERM', shutdown);
process.on('SIGINT', shutdown);
process.on('SIGBREAK', shutdown);
process.on('unhandledRejection', (reason) => {
console.error('Unhandled rejection');
console.error(reason);
process.exit(1);
});
(async () => {
try {
await app.start(process.env.PORT || 3000);
console.log('Bolt app is running!');
} catch (error) {
console.error('Bolt app start failed', error.message);
}
})(); This code works fine. If I uncomment the |
Also if this helps:
|
Thanks! Merged your changes :) |
Description
Using
socketMode = true
withcustomRoutes
(simple health check from documentation in fact) results in[ERROR] Failed to shutdown the HTTP server for OAuth flow: undefined
onapp.stop()
The reason (in my opinion) is this code in
SocketModeReceiver.js
:Here is no condition to check if error occured or not
The fix would be:
What type of issue is this? (place an
x
in one of the[ ]
)Requirements (place an
x
in each of the[ ]
)Bug Report
Filling out the following details about bugs will help us solve your issue sooner.
Reproducible in:
package version:
node version:
OS version(s):
Steps to reproduce:
Expected result:
What you expected to happen
Actual result:
What actually happened
Attachments:
Logs, screenshots, screencast, sample project, funny gif, etc.
The text was updated successfully, but these errors were encountered: