vscode-rdbg icon indicating copy to clipboard operation
vscode-rdbg copied to clipboard

Can't attach to Rails debug session due to false ruby version error in VS code

Open rnorbauer opened this issue 2 years ago • 2 comments

I am using the standard launch.json

{
    "version": "0.2.0",
    "configurations": [
            ...
            {
                    "type": "rdbg",
                    "name": "Attach with rdbg",
                    "request": "attach"
            }
    ]
}

With this first line in my Procfile.dev (loaded by bin/dev)

web: rdbg -n --open=vscode -c -- bin/rails server -p 3000

When I run bin/dev, hit a breakpoint, and attempt to attach, however, I get this error: image

image

Is this dialog being generated by the vscode-rdbg plugin or being passed along from some underlying other utility?

This value appears to be come directly from .ruby-version at my root directory, since if I change that file's value then whatever is set there is the version that the dialog box will mention and say it can't find.

The issue, of course, is that I do indeed have 3.1.3 installed. image

I am, incidentally, running everything on Github Codespaces and attaching to it remotely in desktop VS Code. If I run the "Debug the current file with rdbg" config instead and type bin rails s at the command line, everything works and I don't see this dialog.

So I'm not sure how to go about addressing this issue. Any help would be greatly appreciated.

rnorbauer avatar Dec 07 '22 00:12 rnorbauer

I am, incidentally, running everything on Github Codespaces and attaching to it remotely in desktop VS Code. If I run the "Debug the current file with rdbg" config instead and type bin rails s at the command line, everything works and I don't see this dialog.

Sorry I don't know "Github Codespaces" well. Could you tell me your environments? My understanding is "Github Codespaces" is computing environment with IDE on the cloud. You wrote "remotely in desktop VS Code" so it seems you are running VSCode on your local computer.

My understanding:

  • remote side: Github Codespaces and running a Ruby script with rdbg -A.
  • local side: VSCode (and try to connect to the Codespaces process with it)

Do you install Ruby binaries on your local side?

ko1 avatar Dec 21 '22 06:12 ko1

Hi there. I'm having the same problem.

It seems to me that VSCode is simply acting as a client, and all the actual execution of terminals and such is done on the remote side, so not having Ruby installed on the local side shouldn't be a problem.

@ryush00 ➜ /workspace (ruby-3.1-upgrade) $ which ruby
/usr/local/bin/ruby

Typically, Ruby development in Codespaces uses this docker devcontainer ruby image.

https://mcr.microsoft.com/en-us/product/devcontainers/ruby/about

This image has Ruby installed by default in /user/local/bin/ruby, and not via rbenv.

@ryush00 ➜ /workspace (ruby-3.1-upgrade) $ rbenv versions
rbenv: version `3.1.4' is not installed (set by /workspace/.ruby-version)
  system
@ryush00 ➜ /workspace (ruby-3.1-upgrade) $ ruby -v
ruby 3.1.4p223 (2023-03-30 revision 957bb7cb81) [x86_64-linux]

So running the line below seems to cause that error.

https://github.com/ruby/vscode-rdbg/blob/master/src/extension.ts#L382

ryush00 avatar Apr 20 '23 12:04 ryush00