microsoft / vscode-tye

A Visual Studio Code extension for Tye development
Other
25 stars 9 forks source link

The Dapr dashboard is opened when clicking "Open Dashboard in Browser" button in Tye view #191

Open v-ruizh opened 2 years ago

v-ruizh commented 2 years ago

OS: Win10 Tye Extension Version: 20220629.2 Tye Version: 0.12.0-alpha.22328.1 Dapr Extension Version: 20220629.2

Repro Steps:

  1. Install Dapr extension.
  2. Open an application in VS Code -> Scaffold Dapr Task for it -> Debug with Dapr configuration.
  3. Open Dapr dashboard, close the dashboard.
  4. Install Tye extension.
  5. Download the application by the command "git clone https://github.com/pratiksanglikar/tye-demo.git" -> Open the application in VS Code.
  6. F1 -> Tye Run.
  7. Navigate to Tye view and click "Open Dashboard in Browser" button.
  8. Check whether the tye dashboard is opened or not.

Expect: The tye dashboard is opened. image

Actual: The Dapr dashboard is opened. image

More Info: This issue does not reproduce if not open the Dapr dashboard before open the tye dashboard.

philliphoff commented 2 years ago

It happens that both Dapr and Tye use the same default port for their dashboards (8000). Ordinarily, Tye would choose a random port if it notices the default port in use, but it appears that Tye binds to the 127.0.0.1 address while Dapr binds to the localhost address so technically the port is free, even though the two addresses are generally considered interchangeable.

The VS Code extension should note the address bound with the port and use that for building the dashboard URL, rather than use just the port and then assume localhost. (It looks like the extension has that information during port probing, but just doesn't use it.)

That said, Tye should probably see if its desired dashboard port is already bound to either 127.0.0.1 and localhost and use another port if either is bound with the port, as it's just confusing.