fog-aws gem to upload multipart archive to glacier vault – failing

  Kiến thức lập trình

I am using fog-aws gem version 3.25.0

Here is the code that was working previously but now not working with multipart, if I try without multiple part then it works

glacier = Fog::AWS::Glacier.new(region: ENV['AWS_REGION'],
                                    aws_access_key_id: ENV['AWS_ACCESS_KEY'],
                                    aws_secret_access_key: ENV['AWS_SECRET_KEY'])
vault = glacier.vaults.get(ENV['GLACIER_VAULT_NAME'])
file = MediaFile.find(321)
base_path = Rails.root.join('tmp_glacier_archive').to_s
FileUtils.mkdir_p(base_path)

# this will download the file from the URL to local and return the local filepath
file_path = FileManager.new.create_file(base_path, file.resource_file.url, file.resource_file.expiring_url)

# This is where I am getting an error
archive = vault.archives.create body: File.new(file_path.to_s), multipart_chunk_size: 1024 * 1024 * 32

I am getting this error

/home/deploy/shared/bundle/ruby/3.3.0/gems/fog-aws-3.25.0/lib/fog/aws/glacier.rb:149:in 'hexdigest': undefined method `unpack' for nil (NoMethodError)

          digest.unpack('H*').first
                ^^^^^^^
    from /home/deploy/shared/bundle/ruby/3.3.0/gems/fog-aws-3.25.0/lib/fog/aws/models/glacier/archive.rb:61:in `multipart_save'
    from /home/deploy/shared/bundle/ruby/3.3.0/gems/fog-aws-3.25.0/lib/fog/aws/models/glacier/archive.rb:19:in `save'
    from /home/deploy/shared/bundle/ruby/3.3.0/gems/fog-core-2.5.0/lib/fog/core/collection.rb:53:in `create'```

1

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website Kho Theme wordpress Kho Theme WP Theme WP

LEAVE A COMMENT