question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bolt doesn't seem to work in Lambda

See original GitHub issue

Description

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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alex067commented, Feb 9, 2021

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

1reaction
alex067commented, Feb 8, 2021

Hey @mwbrooks thanks so much for the response

In regards to your questions:

  1. Yes, putting processBeforeResponse: true in the constructor for ExpressReceiver
  2. Currently using 3.x

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Deploying to AWS Lambda - Slack | Bolt for JavaScript
Let's move on to preparing your Bolt app to run as an AWS Lambda function. Get a Bolt Slack app. If you haven't...
Read more >
Troubleshoot Lambda permissions issues - Amazon AWS
A user account doesn't have proper permissions to create, update, or delete Lambda resources. Lambda doesn't have permission to create an ...
Read more >
AWS Lambda function does not recognize my Python ...
I have previously tried to create the same layer zip using ubuntu and it worked, but to implement it officially, I cannot use...
Read more >
Writing AWS Lambda Functions in Ruby - Honeybadger.io
AWS Lambda lets you run your code without worrying about the nuts and bolts of server management or scaling. You might even say...
Read more >
AWS API Gateway to Lambda Tutorial in Python - YouTube
API Gateway is an AWS service that allows you to build HTTP or REST APIs. In this video, I walk you through how...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found