Go4hosting +91-120-6025102

Go4hosting 1-888-288-3570

Delivering Excellence in Data center Hosting Solutions since 2000

Have questions? Let us answer them all!

How To

How to Debug AWS Lambda?

One problem that was often seen as the inability to run and debug functionalities locally. The Visual Studio (VS) Code and the Serverless framework are required for debugging the AWS Lambda using Node.js.  There is an SDK available for Python and Java as well. 

The Serverless framework has a feature to invoke the local command. This emulates the AWS Lambda environment though maybe there could be some minor errors which will not have much impact. 

serverless invoke local --function functionName 

Use the VS Code to debug Node.js. The Visual Studio Code has an inbuilt support feature that can debug the Node.js runtime and debug JavaScript, TypeScript and many other languages. 

Two wire protocols exist:

1. legacy: the original V8 Debugger Protocol which is currently supported by older runtimes.

2. inspector: the new V8 Inspector Protocol is exposed via the --inspect flag in Node.js versions >= 6.3. It addresses most of the limitations and scalability issues of the legacy protocol.

You now can locally run and debug your Lambda functions. 

Step 1: 

Deploy the Serverless framework as devDependency

There are many advantages of using the Serverless framework as a dependency in a project since

1. it enables the developers to integrate their work together with the CI (continuous integration) to avail the Serverless Framework without the need of installing in their systems.
2. It will allow seamless operation even if a non-compatible version of the Serverless Framework Is deployed. Typically, the version to be used must match the one used by the serverless.yml file in the project

3. The file size installed will not make an impact since the Serverless v1.16.0 devDependencies are eliminated from the deployment package,
Step 2: 

Enable the debug configuration

Invoke the “sls invoke local” CLI command serverless invoke local --function functionName

Or the local function invocation can be done with custom context. 

serverless invoke local --function functionName --context "hello world"

You may also invoke the local function with data passing like in a JSON file.

serverless invoke local --function functionName --contextPath lib/context.json

Step 3:

Start debugging

Click on the green triangle icon in the Debug view on the VS Code. This may also be done using your keyboard functions of Ctrl + Shift+ D.  Debug View will show all the relevant information about debugging with a set of commands and configuration settings on the top of the screen. 

The debugging configuration information in a launch.json file is stored by the VS Code in a .vscode folder in the project root folder or in the user settings. To start the debugging session, select Launch Program using the configuration drop-down menu or you could also use Command Palette using the filter on Debug (Select start debugging). The Debug Console status bar will turn Orange. 

The toolbar will show at the top of the editor will display signs like Continue/Pause, Step-over, Step-into, Step-Out, Restart or Stop etc. for you to drag the function you want. The session will stop automatically once the debug program is over. 

Avail the free AWS Cloud demo before your final purchase. Call our experts 1800-212-2022/1888-288-3570.


Threat Detection in Dedicated Servers

Threat detection is the top element on the priority list for cybersecurity cell. Detection is essential because to eliminate threats, you need to see it first. But with so many adversaries that your d....

Read more>>

Cloud computing in Research & Development (R&D)

Cloud computing is, by and large, the most revolutionizing technology in the IT industry. Before cloud technology and virtualization existed, people relied, on what they call physical servers. Physica....

Read more>>

Submit Query

Please fill in the form below and we will contact you within 24 hours.

  • Go4hosting
  • Go4hosting
  • Go4hosting
  • Go4hosting
  • Go4hosting
  • Go4hosting
  • Go4hosting
  • Go4hosting
Hosting Support
Live Chat
Go4hosting Footer
Click here for download from Google Playstore |

AWS Standard Consulting Partner

  • Go4hosting
  • Go4hosting

Alibaba Cloud


Drupal Reseller Hosting Partner

USA Address:

10685-B Hazelhurst Dr. # 15644
Houston, TX 77043
Phone: 1-888-288-3570
Email: [email protected]