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.

Debug mode not starting in SAM Local

See original GitHub issue

Tried starting “-d” mode using invoke and start-api. Both will not listen in debug mode.

Status: Image is up to date for lambci/lambda:go1.x

Mounting dscemails (go1.x) at http://127.0.0.1:3000/collect [POST]

You can now browse to the above endpoints to invoke your functions.
You do not need to restart/reload SAM CLI while working on your functions,
changes will be reflected instantly/automatically. You only need to restart
SAM CLI if you update your AWS SAM template.

Even after sending data, VS Code Debugger still can’t connect to any port I set.

Debugging with legacy protocol because Node.js version could not be determined (Error: connect ECONNREFUSED 127.0.0.1:5858)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

8reactions
sanathkrcommented, Jun 1, 2018

Starting SAM CLI in debug mode is not sufficient to attach a debugger. You should send a invoke request first to spin up the Docker container, which will make the port available for debugger to attach:

  1. Start SAM CLI start-api with --debug-port flag
  2. Send a HTTP request to the endpoint to invoke the Lambda function. At this point, the Docker container is started and your runtime process is waiting for debugger to attach
  3. Attach debugger thru IDE. this should work.

Feel free to re-open the issue if the above didn’t work.

2reactions
fkmarecommented, Jun 20, 2018

Hi Is it possible to debug SAM Local with compiled languages, such as .NET Core?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step-through debugging Lambda functions locally
To run AWS SAM in debug mode, use commands sam local invoke or sam local start-api with the --debug-port or -d option. For...
Read more >
Visual Studio Code Debugger Not Connecting to SAM Local
When running sam local either through a terminal or visual studio code's terminal, set your break points and select the name of your ......
Read more >
Step-through debugging Lambda functions locally
To run Amazon SAM in debug mode, use commands sam local invoke or sam local start-api with the --debug-port or -d option. For...
Read more >
Unable to attach to and debug AWS Lambda functions started ...
It's also possible to start the container in debug mode using the `-d` flag: `sam local start-lambda -d 5678 -t <TEMPLATE_FILE>`.
Read more >
Develop Lambdas And Debug Them Locally Using SAM
Serverless Applications are great, we can get a function up and running in production at super-fast speed, with crazy uptime, and for almost...
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