Codespaces extension returns the wrong local port, causing desktop connection error 1006 #211548
Replies: 2 comments 2 replies
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
The port mismatch described here looks like a strong lead, especially since the reported local hotfix restored connectivity across two Codespaces. If This also fits the documented Codespaces behavior: remote ports can map to different local ports, so the client must use the actual forwarded address. See the [official Codespaces port-forwarding documentation](https://docs.github.com/en/codespaces/developing-in-a-codespace/forwarding-ports-in-your-codespace) and the related [Discussion #156681](https://github.com/orgs/community/discussions/156681), which also reports a Codespaces connection failure with error 1006. The most useful next step would be for the extension maintainers to verify the return value in |
Uh oh!
There was an error while loading. Please reload this page.
🏷️ Discussion Type
Bug
Body
A GitHub Codespace opens in the browser and connects through CLI SSH, but connecting from desktop VS Code fails with WebSocket error 1006. Restarting VS Code did not resolve it.
The GitHub Codespaces extension forwards remote VS Code server port 45475 to local Windows port 48716. Its connection resolver nevertheless tells desktop VS Code to connect to localhost:45475. Windows listener inspection confirmed that localhost:48716 was listening and localhost:45475 was not.
The defect appears to be in
forwardInternalPortin the GitHub Codespaces extension’sout/bundle/extension-node.js. That method receives the actual local listening port fromforwardPortLocallyand records it in telemetry, but returns the original remote server port instead.A local hotfix returning the actual local listening port, while preserving the existing internal-web-port exception, restored desktop connectivity. A second Codespace also connected successfully with different remote and local ports after the hotfix.
The same faulty return logic is present in GitHub Codespaces extension 1.18.15. A deterministic way to trigger the initial port remapping has not been established.
Environment: Windows, VS Code Stable 1.144.0, GitHub Codespaces extension ( GitHub.codespaces ) 1.18.16.
All reactions