10

https://github.com/localstack/localstack

Would like to be able to get step debugging working from my IDE on a node lambda running in localstack. There seems to be support for JVM debugging via LAMBDA_JAVA_OPTS but can't see anything for Node.

How do I open a debug port for a Node app in localstack?

jax
  • 37,735
  • 57
  • 182
  • 278

1 Answers1

1

I was able to get the VS Code debugger to attach to nodejs by doing this. In docker-compose.yml for localstack (notice no quotes):

environment:
  - LAMBDA_EXECUTOR=docker-reuse
  - LAMBDA_DOCKER_FLAGS=-p 9229:9229
  - LAMBDA_REMOVE_CONTAINERS=false        

Create the lambda with this:

--environment Variables="{NODE_OPTIONS='--inspect=0.0.0.0:9229'}" 

If you run docker ps you will see the lambda container running.

d5788b1928ca   mlupin/docker-lambda:nodejs16.x   "/var/rapid/init --b…"   3 minutes ago   Up 3 minutes             0.0.0.0:9229->9229/tcp
Brian
  • 57
  • 3