From an internal report, it was noticed that req.headers === undefined in custom route handlers, which causes runtime errors when attempting to access attributes such as req.headers.host.
Reproducible in:
SDK version: @slack/bolt@3.13.0
Steps to reproduce:
- Initialize an
App using the following:
const app = new App({
token: process.env.SLACK_BOT_TOKEN,
appToken: process.env.SLACK_APP_TOKEN,
socketMode: true,
customRoutes: [
{
method: "GET",
path: "/health",
handler: (req, res) => {
res.writeHead(200)
res.end(`Things are going just fine at ${req.headers.host}!`);;
}
},
],
});
(async () => {
await app.start(3000);
console.log('⚡️ Bolt app is running!');
})();
- Navigate to
http://localhost:3000/health
Expected result:
The req.headers.host attribute to be set to localhost:3000 and the req.headers object to be defined with properties from the request.
Actual result:
The req.headers object is undefined.
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.
From an internal report, it was noticed that
req.headers === undefinedin custom route handlers, which causes runtime errors when attempting to access attributes such asreq.headers.host.Reproducible in:
SDK version:
@slack/bolt@3.13.0Steps to reproduce:
Appusing the following:http://localhost:3000/healthExpected result:
The
req.headers.hostattribute to be set tolocalhost:3000and thereq.headersobject to be defined with properties from the request.Actual result:
The
req.headersobject is undefined.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.