Skip to content

Connection error when trying to debug inside a container #213

@samueldc

Description

@samueldc

Hi everyone,

I'm trying to debug a perl web application (OTRS) inside a container using Plack::Runner.

My VS Code launch.json file is:

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "perl",
      "request": "launch",
      "name": "Perl-Plackup",
      "program": "/opt/otrs/bin/cgi-bin/debug.pl",
      // "args": ["-MPlack::Runner", "-e 'my $runner = Plack::Runner->new;$runner->parse_options(\"--port=3000\");$runner->run(\"/opt/otrs/bin/cgi-bin/app.psgi\");'"],
      "args": ["--port=3000"],
      "stopOnEntry": true,
      "reloadModules": true,
      "containerCmd": "docker",
      "containerMode": "exec",
      "containerName": "otrs-ditec-httpd-1",
      "pathMap": [
        [
          "file:///opt/otrs",
          "file:///workspaces/otrs-ditec"
        ]
      ],
      "env": {
        "PLSDI_REMOTE": "13604"  // Set any required environment variables
      }
    }
  ]
}

And I have a debug.pl file to run a plack web server:

use Plack::Runner;

my $runner = Plack::Runner->new;
#$runner->parse_options("--port=3000");
$runner->parse_options(@ARGV);
$runner->run("/opt/otrs/bin/cgi-bin/app.psgi");

But when I launch debug, get the following error message in the VS Code debug console:

Cannot connect to 127.0.0.1: (No such file or directory) at /usr/share/perl5/Perl/LanguageServer/DebuggerInterface.pm line 1696.
Compilation failed in require.
BEGIN failed--compilation aborted.

Checking at DebuggerInterface.pm line 1696, looks like the port is missing (just a guess). Tried to set PLSDI_REMOTE env variable both in launch.json and in docker-compose.yml but the error message keep the same.

Any thoughts?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions