Debugging

In aws-sdk there are 4 ways to debug locally against deployed resources.

  1. rest api (eg with .http files and a vs code plugin named REST CLient)
  2. debugger with env vars
  3. node script with env vars hardcoded
  4. aws toolkit (eg rt click menu invoke function with event type or file)

VS Code Debugger Configuration

With the following configuration, you can debug locally against any open file. The requests will be sensitive to the root of the directory from which you make them. It behooves you to setup your environment in the root of the project from which you want to debug.

fnm install 22
fnm default 22
corepack enable
corepack prepare pnpm@latest --activate
pnpm add -D tsx
{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Debug local file",
      "runtimeExecutable": "tsx",
      "args": ["${relativeFile}"],
      "env": {
        "AWS_REGION": "us-east-1"
      }
    }
  ]
}