Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mirrord + vscode + templating seems to get ide to hang #2936

Open
aviramha opened this issue Nov 26, 2024 · 4 comments · May be fixed by #3011
Open

mirrord + vscode + templating seems to get ide to hang #2936

aviramha opened this issue Nov 26, 2024 · 4 comments · May be fixed by #3011
Assignees

Comments

@aviramha
Copy link
Member

when running a launch configuration as follows (next dev project, node 18, macOS)

 {  "version": "0.2.0",
  "configurations": [   {
      "name": "NEW",
      "request": "launch",
      "runtimeArgs": [
        "next",
        "dev"
      ],
      "runtimeExecutable": "npx",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "env": {
        "NODE_OPTIONS": "--inspect"
      },
      "type": "node",
      "outFiles": [
        "${workspaceFolder}/x/**/*.(m|c|)js",
        "!**/node_modules/**"
      ],
      "cwd": "${workspaceFolder}/apps/x",
    }
  ]
}

mirrord.json:

{
  "target": {
    "path": "x",
    "namespace": "y"
  },

  "feature": {
    "env": {
      "override": {
        "NODE_EXTRA_CA_CERTS": "{{ get_env(name="HOMEBREW_PREFIX", default="/opt/homebrew") }}/etc/ca-certificates/cert.pem",
        "NODE_ENV": "development"
      }
    },
    "fs": false,
    "network": {
      "incoming": {
        "mode": "steal",
        "http_filter": {
          "header_filter": "x-intercept: {{ get_env(name="USER") }}"
        },
        "port_mapping": [[4003, 8080]]
      },
      "outgoing": false
    }
  },
  "operator": true
}
Copy link

linear bot commented Nov 26, 2024

Copy link
Member

gememma commented Dec 10, 2024

after trying out a few different launch configs, i think the issue may be down to the env field - out of the two following launch configs, the first works with and without mirrord enabled, but the second only works without mirrord (and hangs when mirrord is on):

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Next.js: Working",
            "type": "node",
            "request": "launch",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "runtimeExecutable": "npx",
            "runtimeArgs": [
                "next",
                "dev"
            ],
        },
        {
            "name": "Next.js: Non-working",
            "type": "node",
            "request": "launch",
            "skipFiles": [
                "<node_internals>/**"
            ],
            "runtimeExecutable": "npx",
            "runtimeArgs": [
                "next",
                "dev"
            ],
            "env": {
                "NODE_OPTIONS": "--inspect"
            },
        }
    ]
}

now, we just need to find out what the problem is with using env

Copy link
Member

gememma commented Dec 10, 2024

for now, i think the following configuration should work and do the same thing :) the --inspect flag can only be set in NODE_OPTIONS, and there looks to be interference with mirrord concerning the port that the process listens to - to prevent the hanging until this is fixed, remove --inspect altogether

 { "version": "0.2.0",
  "configurations": [ {
      "name": "NEW",
      "request": "launch",
      "runtimeArgs": [
        "next",
        "dev"
      ],
      "runtimeExecutable": "npx",
      "skipFiles": [
        "/**"
      ],
      "type": "node",
      "outFiles": [
        "${workspaceFolder}/x/**/*.(m|c|)js",
        "!**/node_modules/**"
      ],
      "cwd": "${workspaceFolder}/apps/x",
    }
  ]
}

@aviramha aviramha reopened this Jan 3, 2025
Copy link
Member

gememma commented Jan 7, 2025

mirrord is being loaded into vscode's watchdog extension (which looks to be an activity monitor or some sort) and then trying to render the config with Tera - the call to get_env() is then hanging. This can be worked around by adding a default value, for example "header_filter": "x-intercept: {{ get_env(name="USER",default="default") }}" but should be fixed long-term by stopping mirrord from loading into this process altogether

@gememma gememma linked a pull request Jan 10, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants