Comments (7)
I'm sorry for the delay. I'm quite busy recently, so I'm afraid you need to debug the code on your own. You can also consider switching to a different S3 library.
from s3.
Hi, I had the same problem I will try to debug it but for me solution was:
File.open("file.png", :encoding => "BINARY")
Binary is the key.
If I will find out solution You could find it in my fork.
edit
Is really weird because right now it works even without binary attribute. Something strange going on.
from s3.
Thanks for reporting, please create a pull request when you fix the problem.
from s3.
For anyone trying to figure this out, use File.read instead of File.open or open
from s3.
@abunsenonesale Do you know how to reproduce this error?
Could you also provide explanation for that why read is better then open in this case?
I could not reproduce that error so I do not know if it was related with some specific ruby version or some other black magic.
If you could provide some details it will be cool to understand what happened and to fix that.
from s3.
I have this now, although it was working when I initially implemented it, it now doesn't!
require "s3"
service = S3::Service.new(
:access_key_id => ENV['ACCESS_KEY_ID'],
:secret_access_key => ENV['SECRET_ACCESS_KEY']
)
bucket_name = ENV['BUCKET_NAME']
file = ENV['FILENAME']
bucket = service.buckets.find(bucket_name)
object = bucket.objects.build(file)
object.content = open(file)
object.save
Result
S3::Error::RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.
from /Users/ian/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/s3-0.3.23/lib/s3/connection.rb:216:in `handle_response'
Using : ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
[13] pry(main)> object.content = File.open("/Users/ian/Desktop/test.png")
=> #<File:/Users/ian/Desktop/test.png>
from s3.
Reading over here aws/aws-sdk-js#281 it seems it's an issue with the content-length.
from s3.
Related Issues (20)
- Private by default HOT 5
- Minor error HOT 1
- Interacting with a bucket on s3-eu-central-1 (frankfurt) fails HOT 6
- require "s3" on production. HOT 1
- Occasional "no implicit conversion of nil into String (TypeError)" when calling buckets.find HOT 4
- Error with buckets method HOT 2
- support for ceph-radosgw HOT 4
- None private acl by default HOT 4
- Set File Expiration HOT 1
- Support for Secure URL? HOT 3
- Support for S3 API's outside of AWS HOT 2
- obj.copy method does not parse acl argument HOT 2
- When creating an object first try to GET it HOT 2
- S3::Error::NoSuchKey: The specified key does not exist HOT 2
- warning on ruby 2.4.0 HOT 9
- Version 0.3.26 requires S3::Object#content(true) to fetch object contents HOT 2
- URI escape invalid HOT 3
- Support custom S3 Host HOT 5
- Implement s3_force_path_style HOT 4
- I got an error while trying to save an image to my bucket at S3 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 s3.