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

service/s3: HeadObject documentsNoSuchKey error code returned, but get NotFound #1208

Closed
bsdlp opened this issue Apr 17, 2017 · 4 comments
Closed
Labels
bug This issue is a bug. documentation This is a problem with documentation. service-api This issue is due to a problem in a service API, not the SDK implementation.

Comments

@bsdlp
Copy link

bsdlp commented Apr 17, 2017

I'm on 3d7575d.

The documentation claims that if a key is not found, an error with code s3. ErrCodeNoSuchKey is returned. s3. ErrCodeNoSuchKey is NoSuchKey whereas the actual error returned is NotFound, which means my error check will not match. There is also no const for NotFound.

@jasdel jasdel added the service-api This issue is due to a problem in a service API, not the SDK implementation. label Apr 17, 2017
@jasdel
Copy link
Contributor

jasdel commented Apr 17, 2017

Thanks for contacting us @bsdlp. It looks like the service is modeling this error incorrectly modeling the NotSuchKey error code as being returned from this API operation. I'll reach out to the service team to see if they can update this documentation.

In the meantime the S3 service will return a 404 ("NotFound") when the key does not exist, and 400 ("BadRequest") in other cases such as the bucket doesn't exist.

@jasdel jasdel added the documentation This is a problem with documentation. label Apr 17, 2017
@jasdel jasdel changed the title s3.HeadObject() returns error code NotFound instead of NoSuchKey service/s3: HeadObject documentsNoSuchKey error code returned, but get NotFound Apr 17, 2017
@jasdel jasdel added the bug This issue is a bug. label Apr 18, 2017
jasdel added a commit to jasdel/aws-sdk-go that referenced this issue Apr 18, 2017
The HeadObject's model incorrectly states that the operation can return
the `NoSuchKey` error code.

Fix aws#1208
jasdel added a commit that referenced this issue Apr 19, 2017
The HeadObject's model incorrectly states that the operation can return
the NoSuchKey error code.

Fix #1208
@awstools awstools mentioned this issue Apr 20, 2017
yiranwang52 pushed a commit to uber/kraken that referenced this issue Dec 11, 2018
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Dec 11, 2018
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Dec 11, 2018
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Dec 11, 2018
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Dec 11, 2018
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Jan 4, 2019
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Jan 5, 2019
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
yiranwang52 pushed a commit to uber/kraken that referenced this issue Jan 5, 2019
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
@jameshopkins
Copy link

Any update on this?

@jamesbibby
Copy link

#1220 claims to fix this issue but I don't see how. From what I can see there is no defined error for "NotFound" yet (do you mind if I at least add an ErrNotFound to service/s3/errors.go that can be checked?)

@ryankelley-lm
Copy link

@jasdel ,
Was this issue closed in error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. documentation This is a problem with documentation. service-api This issue is due to a problem in a service API, not the SDK implementation.
Projects
None yet
Development

No branches or pull requests

5 participants