Attaching debugger fails because gems are not loaded
I'm unable to attach the debugger to a running Rails application. When I try to attach, it fails, and I'm told that a long list of gems can't be found:
Could not find rails-7.0.2.3, sprockets-rails-3.4.2, pg-1.2.3, puma-5.2.1...
Run `bundle install` to install missing gems.
A small dialog box opens with a link to run "bundle install". I click on it, and Bundler runs, but that doesn't solve the problem.
I can run my entire test suite from RubyMine, so I'm unsure what's up. I've spent hours trying to get this to work, but no luck.
My environment:
- RubyMine 2022.2.1
- MacOS 12.5.1
- Ruby 3.0.4
- RVM 1.29.12
- Bundler 2.2.33
- Rubygems 3.2.33
Please sign in to leave a comment.
Digging into this a little more, when I run the test suite from inside RubyMine, the generated shell line is this:
And when attaching the with debugger, it is this:
So, it's omitting the gemset name when it's handing the Ruby version to RVM. I don't know if that's on purpose or not. If I copy this command to the shell and include the gemset name, the Bundler error goes away.
I notice that earlier versions of RubyMine include the global gemset here, but that also has the same error. This is from 2022.1.3:
I've confirmed that I've got the correct SDK selected under "Preferences..."
If I remove my named gemset and `bundle install` into global/default then I can successfully attach the debugger to my running Rails server.
I'm glad that I have the workaround, but I'm really unhappy about that.
Hello,
We have a corresponding request on our tracker, could you please take a look and add your vote (https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications) if you find it related:
https://youtrack.jetbrains.com/issue/RUBY-25220/Attach-to-process-uses-non-project-gemset
Hello Olga, this does look like the same issue. I've upvoted.