Skip to content

Unable to Launch Rails Server using DAP #126

@Hawkbawk

Description

@Hawkbawk

Description
Using a fresh Rails project, I'm unable to start debugging the Rails server using Zed's new debugger. If I instead use the just added "attach" functionality done as part of #124, things work great.

Reproduction Steps

  1. Install Ruby and Rails
  2. Create a new Rails project with rails new example_project
  3. Create a .zed/debug.json with the following configuration
[
  {
    "request": "launch",
    "adapter": "rdbg",
    "label": "Launch Rails Server with Ruby extension (Debug)",
    "command": "bin/rails"
  }
]
  1. Start debugging using that task. The console will show a cryptic

error:
error: process exited before debugger attached.

Attempted Debugging Steps
I modified the extension to print out the command and arguments that it was going to use to launch the debugging session. I then ran that same command in a terminal. It was able to start successfully and I was able to attach using rdbg -A -p <port> -h <host>. One odd thing I did notice is that the host was a integer, rather than the typical IPv4 octet style. rdbg doesn't seem to mind this though, so long as you pass the same integer to the attach request.

Known Workarounds

  1. If you install the latest code from main, start the Rails server with rdbg -o -p 12345 -c -- bin/rails s and use the following debug config, all works well.
  {
    "label": "Attach to Rails server",
    "adapter": "rdbg",
    "request": "attach",
    "cwd": "$ZED_WORKTREE_ROOT",
    "env": {
      "RUBY_DEBUG_PORT": "12345"
    }
  },
  1. The built-in Ruby adapter in Zed seems to handle the same JSON config in the repro steps just fine, so something seems to be different between the two, though I'm not sure what.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions