-
Notifications
You must be signed in to change notification settings - Fork 285
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
Documentation should mention that specifying the endpoint is not really optional #95
Comments
I never specify an endpoint, and everything works great to me. What setup are you using that you are constantly getting 307s? Something about regions? I'd appreciate more info. Also, 307 is not a success code:
Only 2xx class codes indicate success, so nothing outside that range should be treated as such. Perhaps that is what really needs to be specified better in the README. |
What region is your bucket in? I bet it's in us-standard, so the endpoint you're getting by default is already the final one. If you try to use the default endpoint with a bucket that lives in the US Oregon region (us-west-2), you get a 307 redirect pointing you there. Which would be OK except that the putFile() function (and the putStream function it depends on) doesn't resolve that automatically. Your callback is invoked without an error, but your file hasn't been uploaded. Without an error it looks like you're done, and confusion ensues. One possible solution is for putStream to follow the redirect. But if putStream isn't going to follow the redirect and complete the job, then it should be documented that you can bypass all this pain just by specifying the right endpoint in the first place, like this: knox.createClient({ Note that the endpoint option, if specified, requires you to include the bucket name in the endpoint hostname yourself, since that is otherwise prepended as part of generating the default value for the endpoint option. FYI, I'm using a region other than the default us-standard region because I need read-after-write consistency, without which there's no certainty people can see the file as soon as AWS claims they have it. But of course folks in Europe and elsewhere have an even more compelling need to do so. |
A 'region' option would be a nice alternative to assembling the endpoint hostname manually. |
OK, I agree we should make this easier. A region option sounds good, and a pull request is welcome. Eventually we'll take care of this by fixing #66. |
Fixed as part of #108. |
I'm finding that putFile consistently reports a false success with a 307 redirect if the endpoint option is not specific to the region. Someone has already reported the issue with 307 being treated as success, but it should also be documented that you're not going to get very far without specifying the precise endpoint for your region rather than the generic one.
The text was updated successfully, but these errors were encountered: