Skip to content

Commit

Permalink
Fix S3 stat 404
Browse files Browse the repository at this point in the history
Summary:
In the logs, we can see this 404 being translated into a 500:

```
2018-05-23T00:21:51.866Z        ERROR   dockerregistry/blobs.go:79      Failed to download sha256:d317746f2ef22a664bfc4df5303416b8b49443484bf44abe08c24812264c1690: remote backend download: all origins unavailable: origin kraken-origin-master01-dca1:9003: GET http://kraken-origin-master01-dca1:9003/namespace/uber-usi%2Fmilton/blobs/sha256:d317746f2ef22a664bfc4df5303416b8b49443484bf44abe08c24812264c1690 500: stat: NotFound: Not Found
```

It turns out that the Go SDK is broken and HeadObject does not return ErrCodeNoSuchKey
on 404s. See aws/aws-sdk-go#1208

Instead, we must check the string manually.

Reviewers: #kraken, yiran

Reviewed By: #kraken, yiran

Subscribers: jenkins

Differential Revision: https://code.uberinternal.com/D1763887
  • Loading branch information
codygibb committed May 23, 2018
1 parent 2306d73 commit b050f44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/backend/s3backend/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,5 @@ func (c *Client) Upload(name string, src io.Reader) error {

func isNotFound(err error) bool {
awsErr, ok := err.(awserr.Error)
return ok && awsErr.Code() == s3.ErrCodeNoSuchKey
return ok && awsErr.Code() == s3.ErrCodeNoSuchKey || awsErr.Code() == "NotFound"
}

0 comments on commit b050f44

Please sign in to comment.