Open jayair opened 5 months ago
Any update on how we can get debug working with Ion? As mentioned, the launch config points to node_modules
but there is no sst
in the .bin
directory of my node_modules
.
Also, this starts the debugger but doesn't trigger any breakpoints:
{
"name": "SST",
"type": "node-terminal",
"request": "launch",
"command": "sst dev",
"cwd": "${workspaceFolder}",
"skipFiles": ["<node_internals>/**"]
}
Edit: The launch config referred to in the docs also doesn't work: https://ion.sst.dev/docs/live/#breakpoints
I'm not sure if this is the same issue, but I want to be able to debug the client side. I'm using Jetbrains (PHPStorm but would be the same for any of their IDE's). If I try running sst dev next dev
I get the following output:
sst dev next dev
SST ❍ ion 0.0.368 ready!
➜ App: <REDACTED>
Stage: <REDACTED>
Console: <REDACTED>
~ Deploying
| Error default_6_35_0 pulumi:providers:aws pulumi:providers:aws resource 'default_6_35_0' has a problem: unable to validate AWS credentials.
Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts.eu-west-1.amazonaws.com/": dial tcp: lookup sts.eu-west-1.amazonaws.com: no such host
× Failed
default_6_35_0 pulumi:providers:aws
pulumi:providers:aws resource 'default_6_35_0' has a problem: unable to validate AWS credentials.
Details: validating provider credentials: retrieving caller identity from STS: operation error STS: GetCallerIdentity, https response error StatusCode: 0, RequestID: , request send failed, Post "https://sts.eu-west-1.amazonaws.com/": dial tcp: lookup sts.eu-west-1.amazonaws.com: no such host
I suspect the docs just need some improvement around how to debug either the frontend or backend.
@dmeehan1968 how's this related to setting breakpoints?
@dmeehan1968 how's this related to setting breakpoints?
I said I wasn't sure if this was related, but I can't debug at all. The docs don't cover debug adequately for me to distinguish.
I really wish we could make it work.
It seems like it works to manually search for the node lambda process and attach it through vscode
VS Code's ability to attach to child Node.js processes can be influenced by the presence of non-Node.js intermediary processes.
In this case, the pnpm run dev would essentially run sh -c sst dev
which would then trigger the execution of the lambda node. And, that would break the chain. I believe it has something to do with it.
It is possible that adding --inspect
to https://github.com/sst/ion/blob/3b273dd735cfa4659fae5714468d5832dfda0156/pkg/runtime/node.go#L203 would solve it.
Does anyone want to try?
Possibly relevant: https://github.com/microsoft/vscode/issues/40123#issuecomment-361529571
That's helpful I think. @thdxr is there something we need to set on our side for this?
Spent a little time playing around with some ideas here but so far it's not looking good. My guess is that the sst server
process is the air-gap that is stopping VSCode from detecting the child node processes.
The lack of debugger support is quickly becoming a show stopper. Separate node processes for each invocation also seems that it could complicate matters. Hope you guys have something planned here.
Yeah it's on the roadmap. We'll get to this in the coming weeks.
Workaround in the meantime:
Install https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input
Edit .vscode/launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug SST Live",
"type": "node",
"request": "attach",
"processId": "${input:sst_pid}"
}
],
"inputs": [
{
"id": "sst_pid",
"type": "command",
"command": "shellCommand.execute",
"args": {
"command": "ps | grep '.sst/platform/dist/nodejs-runtime/index.js' | grep -v grep | awk '{print $1}'",
"useFirstResult": true
}
}
]
}
Run sst dev
Invoke what you're trying to debug (e.g. Lambda function) if it needs to get warm
Run the Debug SST Live
configuration
Set breakpoints
Lambda invocation should now trigger the breakpoint
@jayair Any update on this?
Yeah apparently @thdxr almost has it working.
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug SST Live",
"type": "node",
"request": "launch",
"runtimeArgs": ["dev"],
"console": "integratedTerminal",
"skipFiles": ["<node_internals>/**"],
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/sst"
}
]
}
@jayair @thdxr the config mentioned on the sst.ion docs doestn't seems like working. Is there any update on this issue?
Currently the launch config points to
node_modules
, need to try it with the new CLI.https://discord.com/channels/983865673656705025/1177071497974648952/1221590450314416180
ION-219