# Aws lambda + webpacks + typescript --\> how to debug/trace in vcode?

**URL:** <https://forum.serverless.com/t/aws-lambda-webpacks-typescript-how-to-debug-trace-in-vcode/14274>\
**Category:** Serverless Framework\
**Tags:** aws, lambda\
**Created:** [March 5, 2021, 4:01am UTC](https://forum.serverless.com/t/aws-lambda-webpacks-typescript-how-to-debug-trace-in-vcode/14274 "2021-03-05T04:01:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![olegs](https://avatars.discourse-cdn.com/v4/letter/o/eada6e/32.png) [@olegs](https://forum.serverless.com/u/olegs)\
**Post date:** [March 5, 2021, 4:01am UTC](https://forum.serverless.com/t/aws-lambda-webpacks-typescript-how-to-debug-trace-in-vcode/14274/1 "2021-03-05T04:01:53Z")

</div>

I had created an AWS Lambda with a [serverless framework](https://www.serverless.com/framework/docs/providers/aws/guide/intro/) and used their template to create a lambda:  
`sls create --template aws-nodejs-typescript`

that would create a default example, aka hello lambda with webpack.  
How would I debug/trace this lambda executed locally inside vcode?

I had tried but got an error message:

```auto
[offline] Loading handler... (/Users/mickey/vault/github/backend-work/merlin-lambdas/be-ts-sponsored/.build/.webpack/service/src/functions/hello/handler)
[offline] _____HANDLER RESOLVED_____
offline: Failure: Cannot find module '/Users/mickey/vault/github/backend-work/merlin-lambdas/be-ts-sponsored/.build/.webpack/service/src/functions/hello/handler'
Require stack:
- /Users/mickey/vault/github/backend-work/merlin-lambdas/be-ts-sponsored/node_modules/serverless-offline/dist/lambda/handler-runner/in-process-runner/InProcessRunner.js

```

my VCode debug config is:

```auto
{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "DEBUG",
      "runtimeExecutable": "npm",
      "cwd": "${workspaceRoot}",
      "runtimeArgs": [
        "run-script",
        "debug"
      ],
      "console": "integratedTerminal",
      "restart": true,
      "internalConsoleOptions": "neverOpen",
      "port": 9229
    }
  ]
}

```

and `package.json` file contains the `debug` as:

```auto
"scripts": {
    "start": "serverless offline -s dev",
    "build": "yarn tsc",
    "tsc": "tsc --project tsconfig.json",
    "debug": "export SLS_DEBUG=* && node --inspect ./node_modules/.bin/serverless offline -s dev",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

```

thank you for your help
