Is it possible to run bolt using https instead of http? wondering if this request will require me having to fork.
x in one of the [ ])x in each of the [ ])Filling out the following details about bugs will help us solve your issue sooner.
package version:
node version:
OS version(s):
1.
2.
3.
What you expected to happen
What actually happened
Logs, screenshots, screencast, sample project, funny gif, etc.
Right now the server only uses HTTPS unfortunately. We're definitely open to extending the constructor to make this possible (it's even a comment in the code https://github.com/slackapi/bolt/blob/master/src/ExpressReceiver.ts#L42) but we haven't had the opportunity to get around to it yet.
No problem sounds good if I have some time I'll check it out
Temporary solution while ExpressReceiver isn't upgraded to be able to run https:
const { App, ExpressReceiver } = require('@slack/bolt');
const https = require('https');
const clientTls = {
key: fs.readFileSync('path/to/key.pem'),
cert: fs.readFileSync('path/to/cert.pem')
};
const expressReceiver = new ExpressReceiver({
signingSecret: signingSecret,
clientTls: clientTls
});
// Initialize the app
const app = new App({
...
receiver: expressReceiver
});
...
https.createServer(clientTls, expressReceiver.app).listen(port);
You can also create a custom receiver and then override the self.server variable, which is very similar to @gvashchenkolineate's answer.
const { ExpressReceiver } = require("@slack/bolt");
const { createServer } = require("https");
class CustomReceiver extends ExpressReceiver {
constructor (kwargs) {
super(kwargs);
this.server = createServer({
key: kwargs.clientTls.key,
cert: kwargs.clientTls.cert
}, this.app);
}
};
module.exports = { CustomReceiver };
@zachsirotto Yours is way better solution. Should use it. Thanks!
_any progress here?
if not, i would make my app using @zachsirotto solution.
thanks @zachsirotto_
new.
i found clientTls param in app constructor. i will use it
Hey folks, I'd like to start working on this soon. While evaluating some ideas, I think we would instead like to add HTTPS related options as the second argument to .start() (where the first argument is already port).
This approach helps us avoid adding more options to ExpressReceiverOptions, which in turn need to be added to AppOptions. It's a small benefit, but there doesn't seem to be any significant downside to grouping the HTTPS related options into the same place you specify your port.
Open to any thoughts here, but we're looking to make this happen pretty quickly (like in the next 1-2 days) so the earlier the better.
I believe this is already resolved by the pull request https://github.com/slackapi/bolt-js/pull/658
Feel free to reopen if you see issues with the latest version.
Most helpful comment
Hey folks, I'd like to start working on this soon. While evaluating some ideas, I think we would instead like to add HTTPS related options as the second argument to
.start()(where the first argument is alreadyport).This approach helps us avoid adding more options to
ExpressReceiverOptions, which in turn need to be added toAppOptions. It's a small benefit, but there doesn't seem to be any significant downside to grouping the HTTPS related options into the same place you specify yourport.Open to any thoughts here, but we're looking to make this happen pretty quickly (like in the next 1-2 days) so the earlier the better.