SAM CLI breaks at /var/runtime/index.js every time I invoke my function
Description:
I created the configurations to be able to invoke my lambda function directly using sam cli. The configuration copy is attached below (using code lens).

When I click F5 or press the run button to debug my function it breaks every time in a file that is not in my project called index.js created in the runtime (/var/runtime/index.js) (I believe it's related to sam cli debugging feature).
This stall my development process as I expect it breaks directly at the break point I put in the code.
Steps to reproduce:
- Run sam init
- Choose option 1 (1 - AWS Quick Start Templates)
- Choose option 2 (2 - Image (artifact is an image uploaded to an ECR image repository)
- Choose option 1 (1- amazon/nodejs14.x-base)
- Go to app.js file then click on code lens option (add debug configuration

- Go to run and debug in VS code then select the function configuration you just created and then click run button

Observed result:
It breaks at an breakpoint that does not exist

Expected result:
To break at the breakpoint that I put by myself in the code
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: MacOs Big Sur version: 11.5.1
sam --version: SAM CLI, version 1.31.0- AWS region: US East
Use "debugger" in your code instead breakpoint.
exports.handler = async (event, context) => {
debugger
console.log('event',event.body);
return {
statusCode: 200,
body: JSON.stringify({
event: event,
context: context
})
}
};
The same issue still arises. Debugging the sam application was one of the saddest days in my life. I finally created my own invokes, and like is much easier now. Thank you for your reply.
Hi @ikamal-pxl, sorry for the experience. When I tested it, it stops in a different file first (index.js), and when I click Continue(F5) it stops at the debug point that I set in my code.
Can you confirm that continuing is also working for you? Meanwhile, we will be investigating further to fix the issue.
@ikamal-pxl In your launch config you need to specify "stopOnEntry": false. https://github.com/aws/aws-sam-cli/pull/704 has some additional info on this.
Closing as there hasn't been more information provided. Please reopen if you still encounter the issue.
I have this same issue and if I add "stopOnEntry": false it states that the property is not allowed for this configuration.