-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MICRO-50: Support step through debug with VSCode #549
base: main
Are you sure you want to change the base?
Conversation
@tvhees I'm looking into supporting the same functionality for PHPStorm but probably will be another PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple comments / questions
@@ -4,6 +4,8 @@ | |||
"description": "Serverless ESBuild example using Typescript", | |||
"main": "handler.js", | |||
"scripts": { | |||
"debug-test": "node --inspect=0.0.0.0 ./node_modules/.bin/jest --runInBand", | |||
"debug-invoke-local": "MINIFY=false SOURCEMAP=true node --inspect=0.0.0.0 ./node_modules/.bin/serverless invoke local", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can ./node_modules/.bin/serverless
be changed to use the serverless docker image? We want to avoid confusion for developers where something might work when they run the serverless command but doesn't work when they run serverless from node_modules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@TheOrangePuff : Yes, we can do that. However, I'm not sure if we should do it though. The problem here is that anytime you run serverless
command from inside your project, node will use the locally installed package instead of the global
one as shown below:
$ cat ~/.aligent_aliases
alias node-run='docker run --rm -it -v ~/.aws:/home/node/.aws -v ~/.azure:/home/node/.azure -v ~/.npm:/home/node/.npm -v "$PWD:/app" aligent/serverless:latest'
alias serverless='node-run serverless'
$ serverless --version
Framework Core: 3.22.0
Plugin: 6.2.2
SDK: 4.3.2
$ cd ./serverless-aws-nodejs-service-template
$ rm -rf node_modules
$ node-run npm ci
$ serverless --version
Running "serverless" from node_modules
Framework Core: 3.18.2 (local) 3.22.0 (global)
Plugin: 6.2.2
SDK: 4.3.2
This PR aims to add the ability to debug lambda function with VSCode. There are couple of notes as listed below:
aligent/serverless:debug
docker container for debugging purpose.sourcemap
and disableminify
through environment variable when building withesbuild
to support debugging byinvoke local
.invoke local
to debug. After a code change, the first time we try to debug withinvoke local
, VSCode will fail to attach to the debugger. This happens becauseserverless
will not build our code until we trigger that invocation. All the sub sequence launches will success and we will be able to attach to the debugger normally.