Localstack serverless typescript debug


I try to debug my serverless application in vscode using localstack deploy but I failed!

I’m doing some tests with localstack where I use typescript in my lambda and is triggered by an SQS, which is why I was trying to debug it with localstack.

Some problems I’m facing:

  • The breakpoint only works once, on the first call to the route. After that, it never falls to the breakpoint again. (and the breakpoint isnt the correct one)
  • The breakpoint points to the .js file and not my .ts (I added sourceMaps and it still falls to .js)


  "version": "0.2.0",
  "configurations": [
      "address": "",
      "localRoot": "${workspaceFolder}",
      "name": "Attach to Remote Node.js",
      "port": 9229,
      "remoteRoot": "/var/task/",
      "request": "attach",
      "type": "node",
      "sourceMaps": true,
      "preLaunchTask": "Wait Remote Debugger Server"


  "version": "2.0.0",
  "tasks": [
        "label": "Wait Remote Debugger Server",
        "type": "shell",
        "command": "while [[ -z $(docker ps | grep :9229) ]]; do sleep 1; done; sleep 1;"


version: '3.8'

    container_name: client-localstack
    image: localstack/localstack:latest
      - '4566:4566'
      - '4571:4571'
      - SERVICES=s3,sns,sqs,lambda,apigateway
      - DEBUG=1
      - DATA_DIR=/tmp/localstack/data
      - LAMBDA_EXECUTOR=docker
      - LAMBDA_DOCKER_FLAGS=-e NODE_OPTIONS=--inspect-brk= -p 9229:9229
      - DOCKER_HOST=unix:///var/run/docker.sock
      - AWS_ACCESS_KEY_ID=test
      - './.localstack:/tmp/localstack'
      - '/var/run/docker.sock:/var/run/docker.sock'

Thank you for your time

Hello @jrzaghetto,

Please update your docker-compose.yml file and remove the deprecated configuration.
You can use the default docker-compose.yml.

You can find the legacy variables in Configuration | Docs (localstack.cloud).

Please check with the provided sample to ensure that the Remote Debugging is working before you use your custom setup.

The default configuration works, but only when I’m using javascript + node

In my case I want to use typescript + node. I didn’t find any reference anywhere, since with typescript you have to make it recognize sourceMaps

I need help with this, a debug configuration for serverless typescript + localstack + docker + debug


Can you install the esbuild package in your project and configure a build step in this manner:

"scripts": {
    "build": "esbuild index.ts --bundle --minify --sourcemap --platform=node --target=es2020 --outfile=dist/index.js --watch"

You can run the build script to create the dist/index.js file. While creating the Lambda function, you can reference this as:

awslocal lambda create-function \
    --function-name hello-world \
    --runtime "nodejs18.x" \
    --role arn:aws:iam::123456789012:role/lambda-ex \
    --code S3Bucket="hot-reload",S3Key="$(PWD)/dist" \
    --handler index.handler

I hope this would enable you to make it work. Please let us know, if it doesn’t and we will try to set a small sample application for you :+1: