-
Notifications
You must be signed in to change notification settings - Fork 59
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
Recommend S3 API for basic needs #118
Comments
I mostly agree with your sentiments. I concur, using the S3 API is good for basic needs, but for more advanced usage this library is the most helpful. |
@MarcGuiselin In light of the above, for the issue to be actionable, I would change the title from |
Absolutely. Advanced usage of B2, including backblaze lifecycle rules, are only supported by the native B2 api. |
The official Backblaze position is that
As Backblaze's Chief Developer Evangelist, I'll go further and say that, in general, you should use the S3 Compatible API as far as you can, and only use the B2 Native API for Backblaze-specific features. |
@metadaddy How can I use s3 api with cloudflare alliance? I use my s3 binding to proxy on my cdn, but it detects it as a b2 api instead of an s3 api. |
I noticed that from time to time the S3 compatible API has some issues. I upload millions of small files per week and for example yesterday ~5% of the uploads via S3 compatible API were timing out. I changed to use this library and use the B2 API and the upload were working fine. @metadaddy could this be a problem in the way the S3 Compatible API balances the requests throughout many servers? |
Backblaze has done a very good job implementing compatibility with S3. See: https://help.backblaze.com/hc/en-us/articles/360047425453-Getting-Started-with-the-S3-Compatible-API
Why use the S3 api instead of this library?
Using the S3 api
A simple file upload to backblaze can be done like so with the AWS sdk:
Uploads are faster as this api can be used out of the box and correctly interfaces with backblaze's backend. No need to mess with retries,
In my opinion, this should be recommended as the way forward for new developers looking to get started with B2.
Flaws with this library
Issue #90 highlights one of the MAJOR issues of this library, namely that out of the box it does not support the correct implementation of file uploads as per the official b2 docs here (for example this library does not call b2_get_upload_url again to get a new auth token when the server responds with a 503). As a result, in my own testing uploads can take a few seconds to several of minutes for small 200kb files. It also doesn't set the recommended
X-Bz-Info-src_last_modified_millis
by default, so you have to add this header yourself otherwise b2's file versioning won't work properly.You have to implement these things yourself, and this comes with some trial and error and a lot of reading through the B2 docs.
@cdhowie has done a good job addressing the problems with uploading files with @gideo-llc/backblaze-b2-upload-any, but his library is missing typescript support.
When to use this library
The text was updated successfully, but these errors were encountered: