Git Product home page Git Product logo

Comments (7)

janko avatar janko commented on June 1, 2024

What S3-compatible service are you uploading to? I see mentions of google cloud here. It's possible that this service has slightly different behaviour than S3 does, and that it doesn't accept some arguments.

If you think this happens with AWS S3 as well, could you try reproducing it using the tus-ruby-server's S3 storage directly? For example:

require "tus/storage/s3"
require "stringio"

s3 = Tus::Storage::S3.new(...)
s3.create_file("foo", info = {})
s3.patch_file("foo", StringIO.new("content"), info)
s3.finalize_file("foo", info)

from tus-ruby-server.

jlebrijo avatar jlebrijo commented on June 1, 2024

Error is raising when try to create file:
Selection_331

from tus-ruby-server.

janko avatar janko commented on June 1, 2024

How is your S3 bucket configured? The following script executes without errors for me:

# credentials that have permissions for creating buckets
ENV["AWS_ACCESS_KEY_ID"]     = "..."
ENV["AWS_SECRET_ACCESS_KEY"] = "..."
ENV["AWS_REGION"]            = "..."

require "tus/storage/s3"
require "securerandom"

# create the bucket
client = Aws::S3::Client.new
client.create_bucket(bucket: bucket = SecureRandom.hex)

at_exit do
  # delete the bucket
  client.delete_object(bucket: bucket, key: "foo")
  client.delete_object(bucket: bucket, key: "foo.info")
  client.delete_bucket(bucket: bucket)
end

storage = Tus::Storage::S3.new(bucket: bucket)
storage.create_file("foo", info = {})
storage.patch_file("foo", StringIO.new("content"), info)
storage.finalize_file("foo", info)

from tus-ruby-server.

jlebrijo avatar jlebrijo commented on June 1, 2024

Raises the same error on storage.create_file.

But if you create the file from Aws::S3::Client it works:

client = Aws::S3::Client.new
client.create_bucket(bucket: bucket = SecureRandom.hex)
obj = client.bucket(bucket).object('key')
obj.upload_file('tmp/tmp.csv')

Seems about the difference between two ways to create an object.

from tus-ruby-server.

janko avatar janko commented on June 1, 2024

Yes, the tus server storage will initiate a multipart upload (as you can see from the exception backtrace), which the other will do a simple PUT upload. So, they’re different operations.

Since this works for me, it’s your responsibility to provide more information for reproducing the error. For starters you never answered whether you’re using S3 or an S3-comaptible service.

I will close this now as it doesn’t appear to be a bug in tus-ruby-server.

from tus-ruby-server.

jlebrijo avatar jlebrijo commented on June 1, 2024

Yes, thanks for your help.

It is Google Cloud Storage service. It is a S3 compatible service. I gave 'Admin Storage' role permission to my user, and created S3 keys for it.

from tus-ruby-server.

jlebrijo avatar jlebrijo commented on June 1, 2024

Just found that GoogleStorage and Amazon S3 do not manage multipart uploads the same way: https://www.zenko.io/blog/four-differences-google-amazon-s3-api/

Google suggests resumable uploads for big files: https://cloud.google.com/storage/docs/resumable-uploads

from tus-ruby-server.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.