You can also configure VS Code to debug your tests. Let's look at how to set this up.
To set these up, add the following to
This contains two launch configurations:
Debug SST Start
sst startcommand in debug mode. Allowing you to set breakpoints to your Lambda functions. It also uses the
integratedTerminalmode to allow you to press ENTER when you need to update your CDK infrastructure.
Debug SST Tests
sst testcommand in debug mode. Allowing you to set breakpoints in your Jest tests.
Next, head over to the Run And Debug tab and for the debug configuration select Debug SST Start.
Now you can set a breakpoint and start your app by pressing
F5 or by clicking Run > Start Debugging. Then triggering your Lambda function will cause VS Code to stop at your breakpoint.
By default the timeout for a Lambda function might not be long enough for you to view the breakpoint info. So we need to increase this. We use the
--increase-timeout option for the
sst start command in our
This increases our Lambda function timeouts to their maximum value of 15 minutes. For APIs the timeout cannot be increased more than 30 seconds. But you can continue debugging the Lambda function, even after the API request times out.
Similarly, you can debug the tests in your project by selecting the Debug SST Tests option in the debug configuration dropdown.
This allows you to set breakpoints in your tests and debug them.
We have an example project with the VS Code setup that you can use as a reference.