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

3.0.0 #392

Merged
merged 24 commits into from
Mar 22, 2019
Merged

3.0.0 #392

merged 24 commits into from
Mar 22, 2019

Conversation

kherock
Copy link
Collaborator

@kherock kherock commented Feb 13, 2019

Working changelog:

Breaking changes:

  • You must now specify a specific set of credentials for signed request work. Use S3RVER for both the Access Key ID and Secret Access Key.
  • The underlying app returned by new S3rver(opts) is now a Koa instance. (Koa rewrite #391, resolves Use Koa instead of Express #107)
    • Additionally, some constructor options have been renamed and moved.
  • s3rver.run([callback]) no longer returns a HTTP server instance. The HTTP server created is set at s3rver.httpServer.
  • s3rver.getMiddleware() was renamed to just s3rver.middleware()
  • The RxJS Observable s3rver.s3Event has been removed in interest of keeping the library lightweight. Use s3rver.on('event', handler) instead.
  • Bucket features are no longer globally configured. CORS and static website configurations can be set through S3's API or in custom bucket configurations initialized at server startup.

Features:

Fixes:

  • Support more regions for buckets specified via subdomain
    • For example, eu-west-1 only offers an endpoint at s3.eu-west-1.amazonaws.com (with a period instead of a hyphen after .s3)
  • Buckets operating in "website mode" behave more predictably and should always serve XML-formatted API responses. Real S3 accomplishes this by having totally separate listeners at the DNS/server level, we reconcile this with a single listener by inpecting the Host header and accepted content type.
    • This fixes the "Unexpected token ..." errors reported by the AWS SDK
    • More specifically, S3rver will prioritize Host and fall back to the Accept header. For example, when applicable, requests with
      Host: <bucket-name>.s3[.<region>].amazonaws.com
      will always have XML-formatted responses, but requests with
      Host: <bucket-name>.s3-website.<region>.amazonaws.com
      will always have HTML-formatted responses. Otherwise, S3rver will return HTML when Accept: text/html is present.
  • Virtual Host-style requests (specifying Host: <bucket-name>) should work regardless of static website configuration
  • Metadata missing from multipart uploads (Separate bucket configs for CORS and website policies #397, fixes PUT large object doesn't create custom metadata #306)
  • Querying an object for a key stored without a trailing slash would incorrectly match keys stored with one (Separate bucket configs for CORS and website policies #397)
  • Can't store keys using reserved characters under Windows (Escape invalid path characters in win32 envs #420, fixes BUG & FIX: Windows path bugfix for "Error: ... contains invalid WIN32 path characters."  #390)
  • All error responses reported by S3rver have been revisited and revised to look nearly identical to real S3

This also updates package.json so that ./test isn't included in releases on npm.
This introduces slightly breaking changes to the signature of
s3rver.run() and s3rver.close() since they can now return promises if no
callback is provided.
@kherock
Copy link
Collaborator Author

kherock commented Feb 13, 2019

(btw tests are passing on Node 8, but it looks like Node 10 breaks our app so this release is a bit overdue)

This is working up to be a pretty big release. I do want to also address #110, #153, #306, and #330 before cutting 3.0 since I think those are all pretty essential features. Working with the old code was a pain and didn't leave much room for fixing/adding new features, so I'm not personally up for maintaining the 2.x branch while Node v6 still has a couple months of maintenance before EOL.

@leontastic what are your thoughts on making a new major release without Node 6 support?

In particular, this focuses on
* improved error handling and error formatting
* making S3 features more modular
* significantly more accurate static website behavior
* simplify implementing new features in the future
@wilson208
Copy link

@kherock thanks for your work on this, I find this to be a really useful tool and use it in a couple of different projects currently. I have came across scenario where I need to use pre-signed urls, so seeing this feature go in would be great for next release!

Thanks

@leontastic
Copy link
Collaborator

@kherock I am OK without Node 6 support in next major release.

This also corrects error handling to preserve CORS headers and exclude
x-amz-error- headers from HTML responses.
They are undocumented, and the current behavior doesn't match S3
@kherock
Copy link
Collaborator Author

kherock commented Feb 28, 2019

@leontastic I'm planning on having everything I want for 3.0 finished by the weekend - in the meantime can we get 2.2.9 published?

@jamhall
Copy link
Owner

jamhall commented Feb 28, 2019

@kherock - Hi! Thank you for all of your hard work! I have added you as a maintainer to s3rver on npm. You should be able to push releases now :-)

@leontastic
Copy link
Collaborator

@jamhall Thanks!!

@kherock please feel free to publish/merge without my approval, I trust that you'll be responsible!

@kherock
Copy link
Collaborator Author

kherock commented Mar 21, 2019

Sorry that this hadn't seen any updates in a while, I got really busy the past few weeks (should be starting a new job next week 🤞). In the meantime I finally got v2.2.9 published.

I don't have an ETA for this release, but I think I might patch out the last outstanding bug (#390) and cut it there. I'll try to have everything else show up in v3.1. Thanks for being patient.

…equest behavior

This includes full support for signature version 2 and partial support
for version 4. This also supports
specifing x-amz-meta-* headers via query parameters and overriding response headers via response-* query parameters.
Support verification of signed requests and other special presigned request behavior
@kherock kherock changed the title [WIP] 3.0.0 3.0.0 Mar 22, 2019
@kherock kherock merged commit b98e788 into master Mar 22, 2019
@kherock
Copy link
Collaborator Author

kherock commented Mar 22, 2019

3.0.1 is published! The CLI script had a bad path in the initial 3.0.0 release and was fixed for 3.0.1. ListParts and POST uploads are planned for 3.1.

@kherock kherock deleted the next branch March 22, 2019 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment