Fix this: rake aborted! AWS::S3::Errors::RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

Ok, I have been a couple of hours trying to find the solution to this:

rake aborted!
AWS::S3::Errors::RequestTimeout: Your socket connection to the server was not read from or written to within the timeout period. Idle connections will be closed.

I was trying to run a rake:seed command in heroku

$ heroku run rake db:seed

And I got the above mentioned error once and again. It was strange because the behaviour was erratic, sometimes it would upload one file and break, and the next it could do the following.

Finally, I decided to investigate what was happening in the Amazon Bucket. So I opened the bucket and saw that there were some files. I then deleted all the folders with the contained files. And… magic! the error disapeared.

So what is my conclusion? there was something corrupt, or maybe you cannot run the seeds two times. Honestly, I have not tried a second time. It was already quite hard to get here. Next time I reset the database (it is in a staging app), I will find out if files in AWS S3 have to be deleted each time to avoid this conflict.

Hope this info is useful anyway! good luck

Advertisements

Problem Twitter Bootstrap Glyphicons not show in Heroku

The rails pipeline with Heroku is something difficult to master…

Today I had a problem that has taken some hours to be fixed.

I precompile assets as usual, and I realised that Glyphicon files have a different extension than the usual .js and .css, so I first had to extend it:

config.assets.precompile += %w( *.js *.css *.eot *.woff *.ttf *.svg )

Then I saw that the files were being produced correctly,

"twitter/bootstrap/glyphicons-halflings-regular-a6d95d67a6db3f50ff64b2103e8c9348.woff":{"logical_path":"twitter/bootstrap/glyphicons-halflings-regular.woff"

(excerpt of the manifest.json file)

But they did not show in Heroku

GET http://nexmot.getspeak.com/assets/twitter/bootstrap/glyphicons-halflings-regular.woff 404 (Not Found)

Although I could see them:

$ heroku run bash
$ ls public/assets

After some crazy investigation, this video gave me the solution:

You have to put this line in production.rb

config.assets.compile = true

To learn more, check out this excellent resources:
https://devcenter.heroku.com/articles/rails-4-asset-pipeline
http://guides.rubyonrails.org/asset_pipeline.html