Skip to content

codespace ports isn’t listing all open ports #7855

@huw

Description

@huw

Describe the bug

$ gh version 
gh version 2.32.1 (2023-07-24)
https://github.com/cli/cli/releases/tag/v2.32.1

When running gh codespace ports for my currently running Codespace, it fails to show all of the ports that are currently being forwarded. I am able to determine this because the VS Code Ports view is showing 8 ports, whereas the CLI only shows 1.

Steps to reproduce the behavior

In my case:

  1. Start a Codespace with a port that’s forwarded on startup (in my case, that’s NoVNC, which listens on 6080)
  2. Once the Codespace has started, run a command that opens some ports (in my case, a dev server that opens 6 ports)
  3. Observe that the VS Code Ports view shows all 6 + 1 = 7 ports
  4. Run gh codespace ports -c <CODESPACE_NAME>
  5. Observe that the CLI only lists a single port, which is the originally open one (6080)

This also interferes with the other commands:

$ gh codespace ports visibility 3001:public -c <CODESPACE_NAME>
error updating port 3001 to public: jsonrpc2: code -32098 message: The specified port is not being fowarded
$ gh codespace ports forward 3001:3001 -c <CODESPACE_NAME>
failed to listen to local port over tcp: listen tcp :3001: bind: address already in use

This started happening around the time that GitHub moved from preview.app.github.dev to app.github.dev, but I have no idea if that relationship is causal. What information can I help give you to debug this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcodespacesgh-codespacerelating to the gh codespace command

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions