-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[Bug] InteractiveBrowserCredential not failing in non-interactive environments #22752
Comments
@sinedied I'm trying to understand your scenario, is the idea that this code needs to run both in the browser for customers (using InteractiveBrowserCredential) but also in CI? Can I ask how you are configuring As a possible workaround, would it be possible for you to switch with credential you use based on the current environment? Perhaps the fix could be allowing developers to pass a |
Hi @xirzec , here's the code we're using: https://github.com/Azure/static-web-apps-cli/blob/main/src/core/account.ts#L52-L76 We are trying to support multiple scenarios:
A timeout wouldn't fix the issue for the first scenario, and would not be convenient for the third one. As a user, I would expect these two behaviors:
|
I'm curious to hear more about "If a CI or non-interactive environment is detected", specifically what checks you are thinking of having us perform. Perhaps something like this? https://github.com/sindresorhus/is-interactive/blob/dc8037ae1a61d828cfb42761c345404055b1e036/index.js It is concerning that I'm a bit suspicious of the |
Yes exactly! Regarding the |
@sinedied We do not support InteractiveBrowserCredential in a non-interactive environment or CI-like environment. It's also not part of ChainedTokenCredential. |
@KarishmaGhiya Is this specified somewhere in the docs? I couldn't find any reference to that information, for example here: https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md |
Currently, Interactive Browser Credentials involve a redirect and it doesn't preserve the state of the application. As such, it may not fall back to using the next credential in the loop of ChainedTokenCredential. It is a drawback of the credential. So this may not work as desired. However, are you experiencing the same issue of IBC not working at all when used as is? @sinedied |
I think it was a different one, as the cause was a dangling promise due to the
When used in the correct environment (ie interactive terminal, with a accessible UI) IBC works as intended. Knowing that it's not supported in ChainedTokenCredentials means that we'll probably have to put extra logic from our side to detect non-interactive environment, but the @azure/identity documentation should be updated to precise that. However, taking non-interactive environments aside, there's still I issue when using |
Setting aside the feature work of detecting non-interactive environments and exiting early, it seems like we should be handling spawn failing to open the browser. We don't do anything complicated with
I think what might be happening is that there is a bug with non-zero exit codes in I believe the behavior for |
That would be helpful I think for solving this! Another option would be to propose a PR to fix the issue in |
|
@sinedied Is this issue resolved with the PR merging to |
Hi @sinedied. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue. |
Hi @sinedied, we're sending this friendly reminder because we haven't heard back from you in 7 days. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within 14 days of this comment the issue will be automatically closed. Thank you! |
Hi @sinedied, we deeply appreciate your input into this project. Regrettably, this issue has remained unresolved for over 2 years and inactive for 30 days, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support. |
Describe the bug
When using
InteractiveBrowserCredential
in a non-UI or non-interactive environment (CI, GitHub Actions...) it's stuck waiting indefinitely for an interactive login. When usingChainedTokenCredential
, I would expect it to fail and fall back to the next credentials method chained.To Reproduce
Steps to reproduce the behavior:
Expected behavior
InteractiveBrowserCredential
fails because of non-UI or non-interactive environment.Additional context
Because of this issue, in SWA CLI (https://github.com/Azure/static-web-apps) the app never fall back to using
DeviceTokenCredential
in non-UI environment or gets CI stuck indefinitely in non-interactive environments.The text was updated successfully, but these errors were encountered: