Debug typescript file with breakpoints (credentials via 1password)

September 9th, 2022

because: aws credentials - don't store plaintext

 

op run -- node inspect -r ts-node/register hello.test.ts

(src: Debugger | Node.js v18.9.0 Documentation & AWS & Typescript Masterclass - Testing and debugging Lambdas #31)

 


 

From the terminal itself

no description for image availableno description for image available

(src: How To Debug Node.js with the Built-In Debugger and Chrome DevTools | DigitalOcean)

 


 

from intellij

no description for image available

(Run/Debug Configuration: Attach to Node.js/Chrome | IntelliJ IDEA)

 


 

inspired by the AWS Toolkit for IntelliJ

 

problem: AWS Toolkit requires credentials

solution: fill in fake credentials

~/.aws/config or ~/.aws/credentials

[profile local]

aws_access_key_id = FOO

aws_secret_access_key = BAR

 

problem: is docker installed error message

Error: Running AWS SAM projects locally requires Docker. Have you got it installed and running?

solution:

~/.bashrc and ~/.zshrc

export DOCKER_HOST="unix://$HOME/.colima/docker.sock"

 

problem: AWS Toolkit - no docker found (because not in path?)

solution: /

workaround: run with cmd line cdk run local lambda with sam-cli

 

problem: I want to run lambda locally, but connect with S3, without plaintext creds

solution: cdk run local lambda with sam-cli + aws credentials - don't store plaintext