rdebug-ide with VSCODE returns cannot load such file -- /app/app/rails error

1.5k views Asked by At

I have a dockerized RoR app and I'm trying to run it in debug mode using rdebug-ide and vscode. Already added gems ruby-debug-ide and debase. I installed ruby extension on vscode and created the launch config:

"version": "0.2.0",
"configurations": [
    {
        "name": "Attach to Docker",
        "type": "Ruby",
        "request": "attach",
        "remoteHost": "0.0.0.0",
        "remotePort": "9000",
        "remoteWorkspaceRoot": "/app",
        "cwd": "${workspaceRoot}",
        "showDebuggerOutput": true,
    }
]

On docker-compose.override I added the command:

command: bundle exec rdebug-ide --debug --host 0.0.0.0 --port 9000 -- rails s --host 0.0.0.0 -p 3000

When I run docker-compose up backend I can see the debug server running:

Fast Debugger (ruby-debug-ide 0.7.2, debase 0.2.4.1, file filtering is supported) listens on 0.0.0.0:9000

The problem happens when I start the debug task on VSCODE. I get this error:

Uncaught exception: cannot load such file -- /app/rails

The entry point and workdir on Dockerfile:

WORKDIR /app
ENTRYPOINT ["bundle", "exec"]
CMD ["rails", "server", "--binding=0.0.0.0"]

If I run the app normally with docker-compose up backend and do docker container ls I can see the start command:

bundle exec rails server --binding=0.0.0.0
1

There are 1 answers

5
zooblin On

In my case that was wrong path to rails, try to change it to bin/rails in command:

command: bundle exec rdebug-ide --debug --host 0.0.0.0 --port 9000 -- bin/rails s --host 0.0.0.0 -p 3000