0

In my app an user has the ability to upload their logo to display on their profile page (using Carrierwave + s3).

On my local app the image path is this: https://s3.amazonaws.com/iemarkt/uploads/user/logo/squaredeye_336x336.jpg

But on my Heroku deployed app the image path is "/assets/", which is causing an error and not letting the user upload the image.

Whenever I try to upload a file with Carrierwave + s3 on my Heroku app I get this error "We're sorry, but something went wrong.", looking into my log I see this error:

 2012年08月20日T21:18:56+00:00 app[web.1]: Started GET "/assets/" for 24.90.124.181 at 2012年08月20日 21:18:56 +00002012-08-20T21:18:56+00:00 app[web.1]:2012年08月20日T21:18:56+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets"):

My store_dir

 "uploads/#{model.class.to_s.underscore}/#{mounted_as}/"

I unccomented this line in my production.rb (I read that Heroku uses Nginx, I dont know if there's something else I need to do to get Nginx to work.)

 config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'

I really don't know why the path doesn't lead to my s3 account.

Here's my app

asked Aug 21, 2012 at 23:08
9
  • But is saving the images on S3? Try removing this line from your carrierwave.rb: config.fog_host = 's3.amazonaws.com/iemarkt' Commented Aug 22, 2012 at 1:17
  • Its not I get an error on Heroku saying that somethig went wrong. Commented Aug 22, 2012 at 1:27
  • But what error it gave? For the log you can see the exact error Commented Aug 22, 2012 at 1:41
  • 2012年08月20日T21:18:56+00:00 app[web.1]: Started GET "/assets/" for 24.90.124.181 at 2012年08月20日 21:18:56 +00002012-08-20T21:18:56+00:00 app[web.1]:2012年08月20日T21:18:56+00:00 app[web.1]: ActionController::RoutingError (No route matches [GET] "/assets"): Commented Aug 22, 2012 at 1:42
  • When I look at the broken image link the src is "/assets/" I know thats the error but I dont know how to change it. Commented Aug 22, 2012 at 1:43

1 Answer 1

1

I just tried to deploy your app and it works fine, see my user has an image uploaded

http://young-reaches-9187.herokuapp.com/deals/1

The only thing I changed was in the carrier wave settings, the region name was wrong: you were trying to use the region

'eu-east-1' which doesn't exists, so I changed it to : 'us-east-1'

The full list of regions is available here : http://docs.amazonwebservices.com/general/latest/gr/rande.html

By the way you SHOULD NOT write your AWS credentials in your app. For instance I just uploaded to your bucket, but I could have detroyed your files. You should use environment variables.

You should also add you database.yml in your .gitignore.

answered Sep 30, 2012 at 22:16
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.