Problem with attaching web browser remote debugger to app running in docker container
@ono-max is already working on this.
Since Mar 7, 2023.
Assessment
This issue has not been assessed yet.
Description
Your environment
ruby -v: 3.2.1rdbg -v: 1.7.1
Describe the bug
Hit problem with remote debugger with web browser
Error:
web-1 | ["DEBUGGER Exception: /usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:1233",
web-1 | #<NoMethodError: undefined method `[]=' for nil:NilClass>,
web-1 | ["/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1283:in `block in variable'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `each'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `each_with_index'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1281:in `variable'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1097:in `block in process_cdp'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1095:in `map'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/server_cdp.rb:1095:in `process_cdp'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:1224:in `wait_next_action_'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:856:in `wait_next_action'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:320:in `suspend'",
web-1 | "/usr/local/lib/ruby/gems/3.2.0/gems/debug-1.7.1/lib/debug/thread_client.rb:358:in `block in step_tp'",
I'm running app in docker container (running app in localhost is not an option), thus I setup host/port and path setup so that I was able to attach debugger from web browser to container. When stepping through code it however, it gets often this error, which then breaks app & debugger connection.
Also paths seem to pose a bit problem, which I worker around via creating symlink in host machine filesystem, matching directory structure inside container, and mounted source directory from that symlink into web browser, instead of actual directory in file system. Reason being that web browser seems to send absolute path to file system when setting break point, while inside container sources are at "/app" (in localhost "/home/myaccount/....")
To Reproduce
- have app running in container
- do necessary 0.0.0.0:5555 debug port redirection from docker compose to localhost (port 5555 forwarded to host os side)
- launch app
- connect web browser debugger to app running in container
- set some breakpoint
- do relecant things to trigger breakpoint
- step through code
=> that "undefined method `[]=' for nil:NilClass" will happen sooner or later
Expected behavior
Not to have internal error in debugger
Additional context
"app stack" to understand debugging context, in case it affects problem.

- Dominant language
- Ruby
- Stars
- 1.3k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ruby/debug
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
-
Support exceptionOptions in setExceptionBreakpoints to catch arbitrary exception classes via DAP Open
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
notch8/utk_knapsack#148 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
betagouv/acces-cible#722 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
foobara/empty-ruby-project-generator#10 · 2 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100