question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[@aws-cdk/aws-lambda-nodejs] local debugging

See original GitHub issue

@aws-lambda-nodejs

how to debug locally my lambda with @aws-cdk/aws-lambda-nodejs ? with @aws-cdk/aws-lambda I managed to debug successfully , but this is a similiar but diffrent creature because it’s bundle it to a folder something like cdk.staging/asset-bundle-G0UqOf (where index.js and index.map.js are) if some 1 managed to do it - please share you findings (include launch.json)

UPDATE I managed to debug

{
    "version": "0.2.0",
    "configurations": [
      {
        "name": "Attach to SAM CLI",
        "type": "node",
        "request": "attach",
        "address": "localhost",
        "port": 9999,
        "remoteRoot": "/var/task",
        "localRoot": "${workspaceRoot}/.cdk.staging/asset-bundle-G0UqOf",   
        "protocol": "inspector",
        "stopOnEntry": false        
      }
    ]
  }

but I need to put a breakpoint inside /.cdk.staging/asset-bundle-G0UqOf/index.js which is HUGE LONG file… not so user friendly

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:8
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
eikeoncommented, Jan 21, 2021

Adding the following to NodejsFunctionProps helps here (maps lines in stack traces back to source at least)

            environment: {
                NODE_OPTIONS: "--enable-source-maps",
            },
            bundling: {
                sourceMap: true, // include source map, defaults to false
            },
0reactions
huantbuicommented, Dec 3, 2022

following

Read more comments on GitHub >

github_iconTop Results From Across the Web

Step-through debugging Lambda functions locally
To run AWS SAM in debug mode, use commands sam local invoke or sam local start-api with the --debug-port or -d option. For...
Read more >
How To Test your AWS Lambda Function Locally with CDK
This walkthrough uses Docker, Sam, and CDK to build and debug our lambda function locally within our IDE. Set breakpoints and analyze your ......
Read more >
AWS CDK 101 - SAM local to test and debug lambda function
let us set up local integration testing of the lambda using sam local in our project and see how it helps debug and...
Read more >
Debugging lambda locally using cdk not sam - Stack Overflow
4 Answers 4 · Run your AWS CDK app and create a AWS CloudFormation template. cdk synth --no-staging > template.yaml · Find the...
Read more >
Run and debug an AWS Lambda locally - 040code
Contents · The problem · Tools · A simple Lambda · Required cloud resources · Testing locally. NodeJs; Serverless framework; AWS SAM ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found