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

[Issue] azd monitor doesn't work in devcontainer #394

Closed
jongio opened this issue May 5, 2022 · 10 comments
Closed

[Issue] azd monitor doesn't work in devcontainer #394

jongio opened this issue May 5, 2022 · 10 comments
Assignees
Milestone

Comments

@jongio
Copy link
Member

jongio commented May 5, 2022

Call azd monitor from devcontainer and get:

warning: failed to open default browser: could not open resource: exec: "xdg-open": executable file not found in $PATH

I tried "github.com/pkg/browser" OpenURL and got this:

warning: failed to open default browser: exec: "xdg-open,x-www-browser,www-browser": executable file not found in $PATH

az login and gh auth login work so there has to be a way.

@jongio
Copy link
Member Author

jongio commented May 6, 2022

Since gh auth login does this successfully, I tracked down their browser launching code https://github.dev/cli/cli/blob/9666857f3914c5189e613abd4209edb70fe164ae/pkg/cmdutil/web_browser.go#L12

It looks like they created a custom browser launcher, which we could take the bits that we need from or talk with them about abstracting that into a separate lib.

@ellismg
Copy link
Member

ellismg commented May 6, 2022

Here's where the above seems to be used (and there are some comments about how they probe for what browser to use)

https://github.com/cli/cli/blob/4b415f80d79e57eda48bb67b30cfb53d18b7cba7/pkg/cmd/factory/default.go#L92-L114

@jongio
Copy link
Member Author

jongio commented Jun 13, 2022

Triage: Not a blocker

@puicchan - Please add to known issues.

@vhvb1989
Copy link
Member

@jongio, the az cli doesn't work quite well. For example, running az login from a devcontainer (which is just an instance of vscode-remote, so it can either be a docker container, or a WSL instance, or an SSH-remote connection), a browser window can be launched by vscode to the azure login window, but after logging in to azure, the browser would intent to trigger callback-redirect to return the auth back to vscode and it fails because there's not a port fw from the localhost: to the vscode-remote instance.
The workaround there is to create the port-forward for VScode. But it is annoying because the port is dynamically chosen by vscode when lauching the browser, so we can't predict the port number but after we see it in the browser.

We could try to figure it out if we are running in VSCode-remote and if we do, they we can just print the url to the console and let customers to click on it to open the browser

@jongio
Copy link
Member Author

jongio commented Jun 14, 2022

Try to launch, if fails, fail gracefully.

@savannahostrowski
Copy link
Contributor

I ran into this on WSL as well while running azd monitor. Solved it via cli/cli#826 (comment). We should probably reference this issue/reply in our known issues.

@jongio
Copy link
Member Author

jongio commented Jul 5, 2022

@puicchan Can you please add to known issues?

@puicchan
Copy link
Contributor

puicchan commented Jul 5, 2022

Documented in FAQ on Dev Hub.

@puicchan puicchan removed their assignment Jul 5, 2022
@savannahostrowski savannahostrowski transferred this issue from another repository Jul 28, 2022
@danieljurek danieljurek transferred this issue from another repository Aug 4, 2022
@rajeshkamal5050 rajeshkamal5050 added this to the Backlog milestone Jan 20, 2023
@savannahostrowski
Copy link
Contributor

@puicchan I think this was done as well, right?

@puicchan
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants