diff --git a/README.md b/README.md index b751efc03d..8fa84f737b 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/runtime.go b/runtime.go index 3131c2fa98..71df5a45f9 100644 --- a/runtime.go +++ b/runtime.go @@ -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", @@ -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) } }