--debugger-path is not validated without --debug-port
- Dominant language
- Python
- Stars
- 6.7k
- Forks
- 1.2k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 52
Description
### Description
1. `--debugger-path` is not (fully) validated unless `--debug-port` is given. https://github.com/aws/aws-sam-cli/blob/2201b17bff0a438b934abbb53f6c76eff9ccfa6d/samcli/commands/local/cli_common/invoke_context.py#L340
2. Help description of `--debugger-path` does not mention anything about a directory.
### Steps to reproduce
If `--debug-port` is not given, setting `--debugger-path` to a non-directory is silently ignored (lambda is invoked without debugging):
sam local invoke Foo --template py38/template.yaml --debugger-path /venv/bin/python
Invoking app.lambda_handlerPy38 (python3.8)
...
Setting `--debugger-path` to a binary shows an error (correctly) if `--debug-port` is given:
sam local invoke Foo --template ./template.yaml --debugger-path /venv/bin/python --debug-port 42
Error: '/Volumes/workplace/aws-toolkit-vscode/venv/bin/python' should be a directory with the debugger in it.
### Expected result
1. Mention "directory" in `sam local invoke --help` description of `--debugger-path`:
- > "Host path to a debugger **directory** that will be mounted into the Lambda container."
2. Always validate `--debugger-path`.
- Or always require `--debug-port` if `--debugger-path` is given. Possibly a breaking change :(
### Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
1. OS: macOS
2. `sam --version`: `SAM CLI, version 1.2.0`
Contributor guide
Assessment
This issue has not been assessed yet.