serverless-esbuild: Cannot use debug breakpoint tool on VSCode
When I config this code in serverless.yml, I cannot use debugger breakpoint on VSCode.
esbuild:
bundle: true
minify: true
sourcemap: true
keepNames: true
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 16 (1 by maintainers)
@sinh117801 here’s what I used to get VSCode debugging with this plugin:
Add a launch configuration that starts serverless offline with the debugger attached:
I had to disable minification when debugging, I couldn’t inspect values of local variables otherwise. So put
minify: false(if I’m missing something, do put a comment here). I also had to put sourcemap to ‘linked’; external did not work for me, VSCode wouldn’t load the sourcemaps. So my config is this one:Hi guys! 👋🏻 i have the same issue and i can’t use the plugin with vscode debugger. I mean the breakpoints don’t stop the execution. Also i tried all configuration you mention before without success. I share this repo where you can reproduce the case. If i comment the
serverless-esbuildinserverless.ymlthe vscode debugger works fine!Pointing the outFiles of your launch configuration to
${workspaceFolder}/.esbuild/.build/**/*.jsworked for me:I also noticed that setting
serverless.ts -> custom -> esbuild -> excludeto[]prevents it from working:This worked for me but only after making a request, the first request breakpoints are unbound and they become bound after a test request. Any ideas what might cause this?
guys, all right.
I tried the same configuration but with “linked”
it doesn’t work, I’ve already used some configurations but to debug correctly with esbuild I’m not succeeding.
if using config sourcemap: true it generates the .map but even so the breakpoint execution is still intermittent.
Has anyone ever experienced this ?
I think he wants to run the lambda with attached debugger from node