aws / aws/aws-sam-cli

Bug: Debug Portal not working with sam local start-api dlv and VSCODE

Open
#4,218 5 comments 0 reactions 0 assignees View on GitHub
blocked/more-info-needed maintainer/need-followup stage/needs-investigation
Dominant language
Python
Stars
6.7k
Forks
1.2k
Avg merge
1d 10h
Merged PRs (30d)
52

Description

### Description:

Debug port is not opening up when running sam local command below. only port 5001 is exposed

### Steps to reproduce:

1. ```sam build```
2. ```sam local start-api -p 5001-d 8099 --debugger-path={CORRECT PATH TO dlv} --debug-args="-delveAPI=2"```

### Observed result:

```sam local start-api -p 5001-d 8099 --debugger-path={CORRECT PATH TO dlv} --debug-args="-delveAPI=2"```
OUTPUT:
```
Mounting LambdaFunctionName at http://127.0.0.1:5001/animal [POST]
Mounting LambdaFunctionName2 at http://127.0.0.1:5001/name [POST]
Mounting LambdaFunctionName3 at http://127.0.0.1:5001/address [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
2022-09-09 14:56:46 * Running on http://127.0.0.1:5001/ (Press CTRL+C to quit)
```
launch.json:
```
{
"name": "Debug with sam",
"type": "go",
"request": "attach",
"mode": "remote",
"port": 8991,
"host": "localhost"
},
```

### Expected result:

To show debug section in output and show debug port opened.
When running Debug With SAM in VSCODE I would expect it to attach correctly and not state the following:
```Failed to continue: "Error: connect ECONNREFUSED 127.0.0.1:8991"```

### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)

1. OS: Windows WSLv2 Linux Ubuntu
3. `sam --version`: 1.56.1
4. AWS region: N/A - local run

`Add --debug flag to command you are running`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.