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.

Bot replies twice when Lambda cold starts

See original GitHub issue

Description

I have setup a Slack Bolt on AWS Lambda by following this instruction - https://slack.dev/bolt-js/deployments/aws-lambda#set-up-aws-lambda

I want the Bot to reply ‘hi’ if someone says ‘help’. Sample code:

app.message('help', async ({ message, say }) => {
  await say(`hi`);
});

I noticed that whenever the Lambda is cold, the Bot always says hi twice. But when Lambda is warm, the Bot only replies once. What is the possible solution to prevent the Bot from answering it twice when Lambda cold starts. Thanks!

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 [ ])

  • I’ve read and understood the Contributing guidelines and have done my best effort to follow them.
  • I’ve read and agree to the Code of Conduct.
  • I’ve searched for any related issues and avoided creating a duplicate issue.

Bug Report

Filling out the following details about bugs will help us solve your issue sooner.

Reproducible in:

package version:

        "@slack/bolt": "^3.2.0",
        "@vendia/serverless-express": "^4.3.3",

node version: v12.14.1

Environment: AWS Lambda

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
seratchcommented, Mar 1, 2021

@jc1518 Yes, your idea sounds a great approach to me 👍

1reaction
jc1518commented, Feb 26, 2021

Hi @mwbrooks ,

Thanks for the quick response. Yes, I have the processBeforeResponse: true settings. I am thinking this issue could be caused by the Lambda concurrent execution? When Lambda cold starts, it may trigger more than one execution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring Boot Lambda Startup multiple times at the cold start
I deployed it in the AWS lambda function. At the cold starting each time it initializes twice as shown in the image below....
Read more >
Reflection: AWS Lambda Functions + Slack Bolt | by Yan Kai Lim
When deployed on Lambda, our bot replies 'Hello <name>' twice. The reason for this is because Slack expects a response from the bot...
Read more >
Lambda Cold Starts, A Language Comparison ❄️ (2018)
Cold Start ? A 'cold' start in the serverless world, is the first time in some set period where a request asks for...
Read more >
Your Lambda function might execute twice. Be prepared!
Are you confused when scheduled Lambdas execute twice, SNS messages trigger an invocation three times, your handmade S3 inventory is out of ...
Read more >
Optimizing your Lambda cold starts with serverless-webpack
Some of your npm dependencies may exist twice because they are referenced by multiple modules. A bundler can follow the dependency graph into...
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