VS Code Local Invoke Debugger times out when using using log-file argument
- Dominant language
- TypeScript
- Stars
- 2k
- Forks
- 807
- Avg merge
- 10h 12m
- Merged PRs (30d)
- 7
Description
## Problem
I'm trying to run the vs code debugger for a local lambda invocation.
It was working fine but when I added the log-file argument "localArguments" property to produce logs locally the invocation started timing out.
I have noticed that the log file is created with the following content:
> START RequestId: ce7a3621-0262-4d85-b899-26c78ced885b Version: $LATEST
> Prepending Lambda task root to path: /var/task
> Starting debugger...
> Debugger waiting for client...
but the function itself does not run.
I am able to get the expected result when using the sam cli, The logs are produced and the function runs successfully with the following command:
`sam local invoke --log-file tests/logs/stdout.log --event tests/events/sqs-event.json PolicyIngestionFunction`
## Steps to reproduce the issue
launch.json:
```
{
"version": "0.2.0",
"configurations": [
{
"type": "aws-sam",
"request": "direct-invoke",
"name": "policy_batch_ingestion:app.lambda_handler (python3.9)",
"invokeTarget": {
"target": "code",
"projectRoot": "${workspaceFolder}/SAM/step_functions/policy-sync/functions/policy_batch_ingestion",
"lambdaHandler": "app.lambda_handler"
},
"lambda": {
"runtime": "python3.9",
"payload": {
"path": "${workspaceFolder}/SAM/step_functions/policy-sync/tests/events/sqs-event.json"
},
"environmentVariables": {}
},
"sam": {
"localArguments": ["--log-file","${workspaceFolder}/SAM/step_functions/policy-sync/tests/logs/stdout.log"]
}
},
]
}
```
Directory Tree:
> workspaceFolder
> ┣ /SAM
> ┃ ┗ /step_functions
> ┃ ┗ /policy-sync
> ┃ ┣ /functions
> ┃ ┃ ┣ /policy_batch_ingestion
> ┃ ┃ ┃ ┣ __init__.py
> ┃ ┃ ┃ ┣ app.py
> ┃ ┃ ┃ ┗ requirements.txt
> ┃ ┃ ┗ __init__.py
> ┃ ┣ /statemachine
> ┃ ┃ ┗ policySync.asl.json
> ┃ ┣ /tests
> ┃ ┃ ┣ /events
> ┃ ┃ ┃ ┗ sqs-event.json
> ┃ ┃ ┣ /logs
> ┃ ┃ ┃ ┗ stdout.log
> ┃ ┃ ┣ __init__.py
> ┃ ┃ ┗ requirements.txt
> ┃ ┣ .gitignore
> ┃ ┣ README.md
> ┃ ┣ __init__.py
> ┃ ┣ samconfig.toml
> ┃ ┗ template.yaml
> ┣ .gitignore
> ┗ README.md
## Expected behavior
Expected behavior is that the function would run as if I had triggered it with the cli but with debugging functionality.
## System details
- OS: Ubuntu 22.04.4 LTS
- Visual Studio Code version: 1.91.0
- AWS Toolkit version: v3.12.0
Contributor guide
Research direction
Reproduce the timeout with the shown launch.json, especially the sam.localArguments log-file setting, and compare it with the working `sam local invoke --log-file ...` command. Trace how the AWS Toolkit passes localArguments to the local invocation and debugger, then verify that the function runs, debugging remains available, and the log file is populated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, python, typescript, vscode
- Domain
- cloud, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100