aws / aws/aws-toolkit-vscode

debugging with `"type": "aws-sam"` launch configuration fails

Open
#7,342 1 comment 1 reaction 0 assignees View on GitHub
bug lambda-appbuilder partner-team
Dominant language
TypeScript
Stars
2k
Forks
807
Avg merge
10h 12m
Merged PRs (30d)
7

Description

## Problem
When trying to run a local lambda function with configuration of type `aws-sam`. Getting
```text
connect ECONNREFUSED 127.0.0.1:5858
```

When using the sam cmd vscode is invoking and running it manually in powershell i'm getting:

```text
(general-env) PS C:\xxxxxx\PycharmProjects\unigen_pipeline> sam.cmd `
>> local invoke SendPipelineResultToCaller `
>> --template C:\xxxxxx\PycharmProjects\unigen_pipeline\.aws-sam\build\template.yaml `
>> --event C:\xxxxxx\PycharmProjects\unigen_pipeline\misc\events\SendPipelineResultToCaller.json `
>> --env-vars C:\xxxxxx\PycharmProjects\unigen_pipeline\misc\env_vars\send_pipeline_result_to_caller.json `
>> -d 5858 `
>> --debugger-path c:\xxxxxx\.vscode\extensions\amazonwebservices.aws-toolkit-vscode-3.61.0\resources\debugger `
>> --debug-args "/var/lang/bin/python3.12 /tmp/lambci_debug_files/py_debug_wrapper.py --listen 0.0.0.0:5858 --wait-for-client --log-to-stderr /var/runtime/bootstrap.py"
Invoking Container created from sendpipelineresulttocaller:latest
Building image.................
Using local image: sendpipelineresulttocaller:rapid-x86_64.

START RequestId: cfa9e12a-0cb6-4307-9708-045747d1a270 Version: $LATEST
/tmp/lambci_debug_files/py_debug_wrapper.py:22: SyntaxWarning: invalid escape sequence '\+'
if not re.search('(I|D)\+[0-9]+\.[0-9]+:', message) or self.debug:
Prepending Lambda task root to path: /var/task
Starting debugger...
Traceback (most recent call last):
File "/tmp/lambci_debug_files/py_debug_wrapper.py", line 46, in
runpy.run_module('debugpy', run_name='__main__')
File "", line 222, in run_module
File "", line 142, in _get_module_details
ImportError: No module named debugpy
18 May 2025 12:02:24,859 [ERROR] (rapid) Init failed InvokeID= error=Runtime exited with error: exit status 1
18 May 2025 12:02:24,863 [ERROR] (rapid) Invoke failed error=Runtime exited with error: exit status 1 InvokeID=f590ef91-402f-4ec2-9db4-d4be31693374
18 May 2025 12:02:24,864 [ERROR] (rapid) Invoke DONE failed: Sandbox.Failure
```

- OS: windows 11
- Visual Studio Code version: 1.100.2
- AWS Toolkit version: 3.62.0
- Amazon Q version:

Contributor guide

Open the contributing guide

Research direction

Reproduce the `aws-sam` launch configuration on Windows using the reported `.aws-sam/build/template.yaml`, event and env-vars JSON files, and the generated SAM command. Start with the `py_debug_wrapper.py` traceback and the missing `debugpy` import; done means local invocation starts the debugger and no longer fails with ECONNREFUSED.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.