Comments (5)
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:
This class of status code indicates that further action needs to be taken by the user agent in order to fulfill the request.
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.
from knox.
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({
key: process.env.S3_KEY,
secret: process.env.S3_SECRET,
bucket: 'mybucket',
endpoint: 'mybucket.s3-us-west-2.amazonaws.com'
});
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.
from knox.
A 'region' option would be a nice alternative to assembling the endpoint hostname manually.
from knox.
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.
from knox.
Fixed as part of #108.
from knox.
Related Issues (20)
- Documentation regarding progress
- Option to use x-amz-date header instead of Date
- getFile callback called more than once HOT 1
- Anyone help about Create Bucket with knox? i dont find it HOT 4
- How to debug S3 connection? HOT 3
- Is this repo still maintained? HOT 6
- Allow head requests for S3 buckets
- 403 on getFile on bucket with CRR and versioning on
- Error uploading a file HOT 2
- How is putFile() supposed to work? HOT 2
- Typescript definitions HOT 1
- No access denied error and also missing other errors
- + in secret_key can cause problems
- Download .zip (binary) files HOT 1
- putStream with transfer-encoding chunked HOT 2
- mime dependency breaking changes HOT 11
- Support for deprecated lookup API HOT 3
- Update the readme with deprecation message
- XML parsing Dependency migration HOT 1
- Incorrect sign in function signedUrl when filename contains special chars: !'()#*+? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from knox.