How to deploy a Node.js application to AWS Lambda using Serverless

Adnan Rahić on June 07, 2018

Being a developer is amazing. Writing code, solving problems and thinking of ingenious solutions for complicated algorithms is what we live for. Bu... [Read Full]
markdown guide

Nice article. Also, remember that AWS Lambda fires twice actually.

Its really irritating as I made a bot that sends notification in Telegram Channel & instead of sending 1 message it sends 2 every time.

Checkout for more details.

I am looking for a solution for that problem but unable to find one :(


Strange, and very interesting. I've built a few bots with serverless and never faced any issues, let alone a strange bug like this. Are you sure you've hooked up your events right? 🤔

Also, I see you're using Node8.10, with an async handler but still have a callback parameter. Refactor it so it looks like in this tutorial, and let me know if it works.


I believe you're confusing event triggers with lambda invocations. There seems to be an issue with your CloudWatch trigger, not the lambda function itself. Hence, making it invoke twice. 😊

Yes. Sorry for the confusion but yeah that's the issue. Any workarounds? Or anything that can help me send 1 trigger instead of 2 :)

Also, another thing is I am using Serverless & my cron is put in serverless.yml so if you have any workarounds or solutions to this problem, it would be a great help :)

Checkout the code


Article was very nice, Helped me to start AWS Lambda.

    Actually iam new to Aws Lambda. I have Node.js REST API project(which running on EC2 now) with 100+ api's and 50+ routes and model files. How can i deploy my project into AWS Lambda?.  



Nice article Adnan, I'm developing a service with Lambda but I'm having a little issue for some reason, my API Gateway is timing out, not sure if is the mongo connection or other issue related to Lambda


Hey Adnan, just something to add to your banging tutorial...

There's a bit of a CORS issue with my setup on the express side, regardless of what you set in the API gateway.

The final step was to make sure that Express could handle it with a cheeky include of this:


Thanks for making this article! I love the stuff for beginners like myself. :) Not sure if anyone else ran into this issue but the 'sls' command wouldn't work and I had to use 'serverless' instead. Might be because I'm on a Windows box? Not sure. Either way this was a lot of fun, thanks again! :)


Great article. Thank you very much for posting it!
I'm definitely going to try this thing out.

code of conduct - report abuse