How do I configure my VS Code Rails debugger to launch when Rails is started from a virtual machine running locally?

Viewed 295

I’m using VS Code 1.60.2 for Mac Big Sur. I have my Rails 4 instance running in a virtual machine (vagrant container) and I would like to configure the VS Code debugger. From my local terminal, I could start the server from a shell using the following script …

#!/bin/sh

ssh -t myvirtual.dev "exec bash --login -c 'foreman start -f Procfile.debug'"

So in my .vscode/launch.json file, I configured this

{
  "configurations": [
    {
      "name": "Rails server",
      "type": "Ruby",
      "request": "launch",
      "program": "/opt/scripts/start_web.sh",
      "args": [
      ]
    },

However, when I restart vs code, click the “Run/Debug” icon from the left, and click the “Run” icon next to “Rails server”, I get this error in the terminal …

Uncaught exception: /opt/scripts/start_web.sh:3: syntax error, unexpected tIDENTIFIER, expecting do or '{' or '('
ssh -t myvirtual.dev "exec bash --login -c 'f...

My virtual container has port 3000 exposed, but not sure what else to do to get the debugger configured properly.

0 Answers
Related