Bolt doesn't seem to work in Lambda
See original GitHub issueDescription
Hey guys. I followed the bolt example here for lambda deployments to the tee, aside from using serverless. I’ve used Terraform to deploy the resource, but I don’t think this really matters.
The issue I’m having is that, I am able to receive a proper request via Slack -> Lambda, which is cool. But, it’s not able to recognize any interactions, like messages, etc. Instead, the function just exits.
// Listens to incoming messages that contain "goodbye"
app.message('goodbye', async ({ message, say }) => {
// say() sends a message to the channel where the event was triggered
console.log("triggered")
await say(`See ya later, <@${message.user}> :wave:`);
});
// Handle the Lambda function event
module.exports.handler = (event, context) => {
console.log('⚡️ Bolt app is running!');
console.log(event, context)
awsServerlessExpress.proxy(server, event, context);
};
In this case, the console output “triggered” is never executed. I do see the event and context showing up in the log, but it just seems like the function exits before it can do anything else.
The codebase is literally the same as the example, just added some console statements.
What type of issue is this? (place an x
in one of the [ ]
)
- bug
- enhancement (feature request)
- question
- documentation related
- example code related
- testing related
- discussion
Requirements (place an x
in each of the [ ]
)
- [x ] I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
- [x ] I’ve read and agree to the Code of Conduct.
- [x ] I’ve searched for any related issues and avoided creating a duplicate issue.
Reproducible in:
node version: 12
Expected result:
When I say “goodbye” or “hello”, I expect a response back.
Actual result:
No response.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:8 (4 by maintainers)
Hey @seratch I was able to confirm via cloudwatch, since i just console log the event and context from the handler.
So it hits the handler for sure, but its just not hitting the app.message event.
The source code is 100% the same from the docs. The only difference is additional console.logs, that’s it really!
However, I did notice that this works completely fine for the following middlewares (I think they’re middlewares right?): app.command app.view app.action
For some reason, app.message seems to be the only one that’s not being called correctly
Hey @mwbrooks thanks so much for the response
In regards to your questions:
Thank you!