-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
VSCode debugging #364
Comments
Hi @franciscocpg , thanks for bringing this up. yes, we indeed have debugging working here. It is setup via a task in
This works perfectly on Windows, MacOS and Linux. You even could add a launch task for each stage you debug. The As we have serverless installed with each project, our launch template of course refers to the serverless binary located in node_modules. But that should work the same with a globally installed serverless. Additionally, I wrote the serverless-vscode extension for VSCode because I was annoyed by using a command line every time to do anything else than debugging (i.e. deploy a single function for debugging, inspecting the logs, etc...) |
Hi @HyperBrain I'm going to give a try using this Also could you please provide a sample of the
|
The webpack config from the example should work. We also use So, the sample should work as given. Of course you have to add |
It worked fine using After reading this article again I've changed to I don't know why it works only when passing ASAP I'm going to open a PR adding those 2 configurations (with serverless-offine and invoke local) to Are you ok with adding |
Yes, add it to the example. I think it is already kind of standard to use serverless-offline. BTW: The data option is quite strange, but good to hear that it works that way. I'm sure that is a bug in serverless. Any omitted data options should default the event data for invoke local to an empty object and not undefined. |
@HyperBrain the debugging config for vscode does not start dynamodb local, do you know why? |
@Macs91 As far as I remember, you have to use |
@HyperBrain I've already done so, but as soon as I add {
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Serverless Offline",
"program": "${workspaceRoot}/node_modules/serverless/bin/serverless",
"args": ["offline", "start", "--noTimeout", "--dontPrintOutput"],
"sourceMaps": true,
"runtimeArgs": ["--lazy"],
"outFiles": ["${workspaceFolder}/.webpack/**/*.js"],
"protocol": "inspector",
"runtimeExecutable": "node",
"env": {
},
"windows": {
"program": "${workspaceRoot}\\node_modules\\serverless\\bin\\serverless"
}
}
]
}
Without |
This doesn't work for me. Exceptions will get caught in VS Code, but execution stops and opens the webpack source (root/.build/.webpack/service/src) instead of root/src. Note: I'm using serverless-bundle. Does that change anything? |
Hi @HyperBrain
First of all, sorry for not using the issue template but this is a question (not a bug or feature propose).
Personally I don't use debug (just a personal preference, but I don't have nothing against it) but a lot of my coworkers are starting to request this feature in
vscode
withserverless-webpack
.So far I have found these references trying to start a debug session:
The
1.
approach does not work out of the box forserverless-webpack
so I've tried to mix it with the2.
approach without success.Reading #42 it looks like you have success debugging.
If you can share in this issue how are you achieving that I could open a PR adding this topic to
README
(debugging in VSCODE
) and updating some of our examples (let's sayexamples/babel-webpack-4
) to show how to do that so others could have that benefit too.The text was updated successfully, but these errors were encountered: