2

Opening Disclaimer: I'm all kinds of newb to the technologies involved in this question. But the Googles, she no yield-a the fruit.

I'm trying to deploy a Rails app into production. This app works fine using WEBRick. I am also using the AWS gem to retrieve data from S3.

I have installed and set up Nginx with Passenger. When I hit the page I'm testing I get this error:

/home/ec2-user/.gem/ruby/2.0/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: `@@{' is not allowed as a class variable name
/home/ec2-user/.gem/ruby/2.0/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: syntax error, unexpected end-of-input
    unless defined? @@{:instance_writer=>false}
                      ^ (SyntaxError)

I guess something about Nginx/Passenger/Who-Knows is choking on the AWS code, but again, using WEBRick, I don't get this error.

Dave Munger
  • 141
  • 3

1 Answers1

1

It is due to the fact that aws-s3 is doing something evil. If you look at the code in that stack trace, you can see that they open class Class and add cattr_reader and cattr_writer. ActiveSupport also does this and adds methods by those same names to Module I do not have the code but I am pretty sure that when you use Passenger, it is including the ActiveSupport 4.0 version of cattr_reader/cattr_writer and blowing up on this.

My solution would to be to replace aws-s3 with the newer and more functional aws-sdk

  • I tried the aws-sdk library but it looked like they had removed the ability to get a temporarily signed URL for an s5 resource. If not, then they moved it into a different class. I could not find it. I wound up rewriting the logic in the front end, using the aws library for js, and using node.js for some light back end stuff. Everything works fine, and I found it much easier to deal with. – Dave Munger Jun 24 '14 at 19:44