Search code examples
herokuamazon-s3redmineredmine-plugins

403 Error using redmine_s3 plugin on Heroku


I am running Redmine (1.2-stable branch from http://github.com/edavis10/redmine) on Heroku and want to use the redmine_s3 plugin (https://github.com/tigrish/redmine_s3) to store the assets on S3.

I used this guide for the setup: http://blog.firsthand.ca/2010/10/installing-redmine-on-heroku-with-s3.html

It works great locally, when I start Redmine (in production enivonment) it creates the configured bucket and stores any assets I upload in there.

But when I try to run it on Redmine it crashes on the first request to Heroku

/usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:2303:in `error!': 403 "Forbidden" (Net::HTTPServerException)
from /app/vendor/plugins/redmine_r3/lib/S3.rb:306:in `block in make_request'
from /usr/ruby1.9.2/lib/ruby/1.9.1/net/http.rb:627:in `start'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:281:in `make_request'
from /app/vendor/plugins/redmine_r3/lib/S3.rb:157:in `create_bucket'
from /app/vendor/plugins/redmine_r3/lib/redmine_s3/connection.rb:57:in `create_bucket'
from /app/vendor/plugins/redmine_r3/init.rb:17:in `block in <top (required)>'

The offending line is here: https://github.com/tigrish/redmine_s3/blob/master/lib/S3.rb#L306

I double and triple checked, the configuration on Heroku and my local machine (S3 credentials, bucket name, etc.) is exactly the same. I tried different bucket names and S3 credentials, still the same error. Redmine itself (without the redmine_s3 plugin) works just great in Heroku. Just as soon as I add the plugin... boom!

I suspect that the request from Heroku to S3 has some weird headers or other properties that make S3 reject the request.

Can anyone confirm or deny this? I would be happy about any ideas on how to make this work.


Solution

  • In the end, it actually was an issue with Ruby 1.9.2. As soon as I downgraded to 1.8.7, it started working! :) Thanks to Jack Chu in the comments to Eric Davies for bringing me on the right track.