Debugging `serverless-offline` with vscode debugger
Problem
When using vscode as a IDE and the framework is serverless-offline.
If you try to debug typescript code with breakpoint, it may not work properly.
TL; DR;
Set up serverless-esbuild configuration in serverless.yml
custom:
esbuild:
bundle: true
platform: node
target: node18
sourcemap: true # THIS WILL MAKE THE BREAKPOINTS ON TS FILE WORK
sourcesContent: true
keepNames: true
Detailed Configuration
- IDE:
vscode - Framework:
serverless - Local runtime:
serverless-offline- Run local debug server with
sls offline
- Run local debug server with
- Development language:
typescript - Build with:
serverless-esbuild
In normal case, any node process can be debugged with vscode with JavaScript Debug Terminal. but, when running sls offline, it seems the debugger session is attached to the process but the breakpoints are not working.
After several googling, there were try launch.json configuration, use SLS_DEBUG and etc.



