Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Inspector instead of Legacy Debugger #285

Merged
merged 7 commits into from
Feb 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,12 +249,14 @@ In order to setup Visual Studio Code for debugging with AWS SAM Local, use the f
"port": 5858,
"localRoot": "${workspaceRoot}",
"remoteRoot": "/var/task",
"protocol": "legacy"
"protocol": "inspector"
}
]
}
```

Note: You must detach your debugger in order for the result to be sent back to AWS SAM Local.

#### Debugging Python functions

Unlike Node.JS and Java, Python requires you to enable remote debugging in your Lambda function code. If you enable debugging with `--debug-port` or `-d` for a function that uses one of the Python runtimes, SAM Local will just map through that port from your host machine through to the Lambda runtime container. You will need to enable remote debugging in your function code. To do this, use a python package such as [remote-pdb](https://pypi.python.org/pypi/remote-pdb). When configuring the host the debugger listens on in your code, make sure to use `0.0.0.0` not `127.0.0.1` to allow Docker to map through the port to your host machine.
Expand Down
5 changes: 3 additions & 2 deletions runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ func (r *Runtime) getDebugEntrypoint() (overrides []string) {
}
overrides = append(overrides, debuggerArgsArray...)
overrides = append(overrides,
"--debug-brk=" + r.DebugPort,
"--inspect=" + r.DebugPort,
"--debug-brk",
"--nolazy",
"--max-old-space-size=1229",
"--max-semi-space-size=76",
Expand Down Expand Up @@ -619,7 +620,7 @@ func parseOutput(w http.ResponseWriter, stdoutTxt io.Reader, runtime string, wg
// Set any HTTP headers requested by the proxy function
if len(proxy.Headers) > 0 {
for key, value := range proxy.Headers {
w.Header().Set(key, value)
w.Header().Add(key, value)
}
}

Expand Down