Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A user was reporting a panic when running
pulumi stack select
. It was odd because the panic only happened when you get prompted and manually type in the stack name, but not when you runpulumi stack select xxx
.After more head scratching than I would like to admit, it boiled down to a new class of auth error on the Pulumi Service. (https://github.com/pulumi/pulumi-service/issues/4446) We return a stack
xxx
to the user, so it shows up in the list of available stacks to choose from. But when we actually go and get that stack (backend::Get
) that returns(nil, nil)
as is expected when the stack does not exist.(Because of the specific way we are interpreting a 403 error we are getting from a 3rd party service, we are acting as if the stack doesn't exist at all.) And that's why we had the panic.
The meaningful part of this PR is just adding a new check for the case that
backend::Get
returns(nil, nil)
and returning an appropriate error. Though until we fix the issue in the Pulumi Service, the user in this state will still see some confusing behavior. (Runningpulumi stack select
will show a stack in the list of stacks to choose from, but if you select it you get a "stack does not exist" error.)But we'll just properly omit that from the list of stacks returned server-side. The CLI just needs to account for this corner case and not panic.
Fixes #3673