Skip to content

Commit

Permalink
Merge pull request #285 from kintalapps/develop
Browse files Browse the repository at this point in the history
Use Inspector instead of Legacy Debugger
  • Loading branch information
PaulMaddox authored Feb 27, 2018
2 parents 453c34a + 892a36e commit 2c3cb7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
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

0 comments on commit 2c3cb7c

Please sign in to comment.