Skip to content

Commit

Permalink
Fixing Read failure of 404 from Pulumi Service (#313)
Browse files Browse the repository at this point in the history
### Summary
- The crux of the issues turned out that ESC client lumps in 404 with
other errors
- So we need to NOT throw error on 404, but instead just return empty
response

###Testing
- Follow repro steps after fix, bug no longer happens
  • Loading branch information
IaroslavTitov authored Jun 15, 2024
1 parent 9ea92d8 commit bfd8b59
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG_PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Bug Fixes

- Fixed Read failure on 404 from Pulumi Service [#312](https://github.com/pulumi/pulumi-pulumiservice/issues/312)
- Fixed environment tests breaking due to name collision [#296](https://github.com/pulumi/pulumi-pulumiservice/issues/296)
- Fixed import for Schedules [#270](https://github.com/pulumi/pulumi-pulumiservice/issues/270)
- Fixed noisy refresh for Team resource [#314](https://github.com/pulumi/pulumi-pulumiservice/pull/314)
Expand Down
5 changes: 3 additions & 2 deletions provider/pkg/provider/environment_version_tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"path"
"strings"

pbempty "google.golang.org/protobuf/types/known/emptypb"

Expand Down Expand Up @@ -163,8 +164,8 @@ func (evt *PulumiServiceEnvironmentVersionTagResource) Read(req *pulumirpc.ReadR
}

tag, err := evt.client.GetEnvironmentRevisionTag(ctx, input.Organization, input.Environment, input.TagName)
if err != nil {
return nil, fmt.Errorf("failed to read StackTag (%q): %w", req.Id, err)
if err != nil && !strings.Contains(err.Error(), "404") {
return nil, fmt.Errorf("failed to read EnvironmentVersionTag (%q): %w", req.Id, err)
}
if tag == nil {
// if the tag doesn't exist, then return empty response
Expand Down

0 comments on commit bfd8b59

Please sign in to comment.