Reputation: 8637
New to VSCode i tried to debug an existing Rails app that Runs within Docker (started via docker compose)
I followed the instructions on https://github.com/rubyide/vscode-ruby (installed the gems + extension, launch config).
I can start puma and see breakpoints being added
some-app_1 | 1: <breakpointAdded no="3" location="...../some-app/app/controllers/hello_worlds_controller.rb:4"/>
But when I hit the above controller with a request, the breakpoint does not kick in (request just passes).
launch config:
{
"version": "0.2.0",
"configurations": [
{
"name": "some-App",
"type": "Ruby",
"request": "attach",
"remoteHost": "127.0.0.1",
"remotePort": "1234",
"remoteWorkspaceRoot": "${workspaceRoot}",
"cwd": "${workspaceRoot}",
}
]
}
There is nothing in the Ruby output channel or in the logs of the container.
I assume I am doing something wrong? Or something is missing?
Upvotes: 1
Views: 1815
Reputation: 503
It seems your remoteWorkspaceRoot it's pointing to your local machine, the debugger needs to know what file should he watch to break inside the docker container
For example, if inside your docker container, your project is on "/app", you should change your remoteWorkspaceRoot variable to "/app"
In console you should see
some-app_1 | 1: <breakpointAdded no="3" location="your-docker-path-to-the-project/some-app/app/controllers/hello_worlds_controller.rb:4"/>
instead of
some-app_1 | 1: <breakpointAdded no="3" location="...../some-app/app/controllers/hello_worlds_controller.rb:4"/>
and that should work fine if you are not using Windows (backlashes compatibility)
Upvotes: 2