AWS SDK SAM VS Code debugger runs but why does it break on internal /var/runtime/index.js first?

Viewed 169

It's debugging the wrong file when the debugger starts up.

enter image description here

Using SAM CLI 1.40 and latest VS Code. I followed directions here:

https://docs.aws.amazon.com/toolkit-for-vscode/latest/userguide/serverless-apps-run-debug-no-template.html

Here's my launch.json entry, generated by following directions above:

    {
        "type": "aws-sam",
        "request": "direct-invoke",
        "name": "videoPostUpload",
        "invokeTarget": {
            "target": "code",
            "projectRoot": "${workspaceFolder}/my-lambda-fn/videoPostUpload",
            "lambdaHandler": "index.lambdaHandler"
        },
        "lambda": {
            "runtime": "nodejs14.x",
            "payload": {},
            "environmentVariables": {}
        }
    }

Here's my function:

exports.lambdaHandler = async event => {
    const response = { //breakpoint here works properly, after /var/runtime/index.js!
        statusCode: 200,
        body: {
            message: "Hello SAM!"
        }
    };
    return response;
};

Instead, it launches /var/runtime/index.js first - even though there's no breakpoints in that file. Minor problem, but annoying if I include Lambda functions in my compound debugging configs, in launch.json. I'd rather not stop the debugger at this file every time I'm debugging across my entire platform.

Is there a way to exclude this file? Am I configured incorrectly?

0 Answers
Related