Skip to content

Commit

Permalink
Improve deprecated Lambda debug docs (#736)
Browse files Browse the repository at this point in the history
* Fix missing trailing slashes in add-layer-version-permission command

* Remove deprecated and unrelated configuration

* `LAMBDA_REMOTE_DOCKER` is deprecated and not required since LocalStack 2.0 anymore
* `DEBUG=1` is not related to remote debugging.
  • Loading branch information
joe4dev authored Aug 1, 2023
1 parent c07bc89 commit f2c8c5d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
10 changes: 5 additions & 5 deletions content/en/user-guide/aws/lambda/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ If your Lambda function references a layer in real AWS, you can integrate it int
To grant access to your layer, run the following command:

{{< command >}}
$ aws lambda add-layer-version-permission
--layer-name test-layer
--version-number 1
--statement-id layerAccessFromLocalStack
--principal 886468871268
$ aws lambda add-layer-version-permission \
--layer-name test-layer \
--version-number 1 \
--statement-id layerAccessFromLocalStack \
--principal 886468871268 \
--action lambda:GetLayerVersion
{{< / command >}}

Expand Down
9 changes: 3 additions & 6 deletions content/en/user-guide/tools/lambda-tools/debugging/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ There, the necessary code fragments for enabling debugging are already present.
First, make sure that LocalStack is started with the following configuration (see the [Configuration docs]({{< ref "configuration#lambda" >}}) for more information):

{{< command >}}
$ LAMBDA_REMOTE_DOCKER=0 \
LAMBDA_DOCKER_FLAGS='-p 19891:19891' \
DEBUG=1 localstack start
$ LAMBDA_DOCKER_FLAGS='-p 19891:19891' localstack start
{{< /command >}}

#### Preparing your code
Expand Down Expand Up @@ -136,7 +134,7 @@ You can [follow the steps in the offical docs](https://www.jetbrains.com/help/py

#### Preparing your code

PyCharm provides a its own debugging package, called `pydevd-pycharm`. Essentially, you will add the following code to your lambda:
PyCharm provides its own debugging package, called `pydevd-pycharm`. Essentially, you will add the following code to your lambda:

```python
import pydevd_pycharm
Expand Down Expand Up @@ -284,7 +282,7 @@ lambda function.

### Configure LocalStack for remote Node.js debugging

`LAMBDA_REMOTE_DOCKER` has to be disabled, and `LAMBDA_DOCKER_FLAGS` needs to enable the debugger using `NODE_OPTIONS`:
Set the `LAMBDA_DOCKER_FLAGS` to enable the debugger using `NODE_OPTIONS`:

```yaml
#docker-compose.yml
Expand All @@ -294,7 +292,6 @@ services:
...
environment:
...
- LAMBDA_REMOTE_DOCKER=0
- LAMBDA_DOCKER_FLAGS=-e NODE_OPTIONS=--inspect-brk=0.0.0.0:9229 -p 9229:9229
```

Expand Down

0 comments on commit f2c8c5d

Please sign in to comment.