-
Notifications
You must be signed in to change notification settings - Fork 394
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
Cannot use Custom SocketMode Receiver #1180
Comments
This issue is related to #1179 as this is the only workaround I can think of at the moment |
@M1kep - So I thought I could recreate an error using the documentation code sample, but was mistaken. Could you provide the error + the app initialization code you're using? If you're using a custom SocketModeReceiver, you should not set The app initializes for me with the below:
Let me know if I'm missing something! |
@srajiang So, I've messed around this this a little bit more and have it working. The two issues were the I'm able to get it functioning with the import {config} from 'dotenv';
import {App, SocketModeReceiver} from "@slack/bolt";
config({path: './.env'})
const socketModeReceiver = new SocketModeReceiver({
// @ts-ignore Ignore the possibly undefined environment variable as this is just an example
appToken: process.env.APP_TOKEN,
// disable token line below if using OAuth
token: process.env.BOT_TOKEN,
signingSecret: process.env.SIGNING_SECRET,
customRoutes: [
{
method: 'GET',
handler: (req, res) => {
console.log(req.headers);
console.log('HTTP Hit! - /test');
res.end();
},
path: '/test'
}
],
installerOptions: {
port: 8080,
}
}
);
const app = new App({
receiver: socketModeReceiver,
// @ts-ignore Ignore the possibly undefined environment variable as this is just an example
appToken: process.env.APP_TOKEN,
// disable token line below if using OAuth
token: process.env.BOT_TOKEN,
signingSecret: process.env.SIGNING_SECRET,
});
(async () => {
await app.start();
console.log('⚡️ Bolt app started');
})(); Result:
|
@M1kep It's great to hear that you've figured out how to configure the receiver! Let us close this issue now. |
Description
When I attempt use a custom SocketMode receiver when creating a new App instance, it throws an error.
It looks like this PR added the throw that now conflicts with the documentation:
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:3.7.0
node version: v16.9.1
Typescript Version: 4.4.3
OS version(s): macOS Monterey - 12.0.1 (21A559)
The text was updated successfully, but these errors were encountered: