Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`@@{' is not allowed as a class variable name (SyntaxError) while using s3 gem + rails 4.1.5

I know this type of question is already asked.

I use s3 gem to upload my files in s3 bucket. But after s3 gem installation, when I start rails server it shows this error:

    /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223:in `class_eval': /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: `@@{' is not allowed as a class variable name (SyntaxError)
/var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223: syntax error, unexpected $end
        unless defined? @@{:instance_writer=>true}
                          ^
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:223:in `block in cattr_reader'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:222:in `each'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:222:in `cattr_reader'
    from /var/lib/gems/1.9.1/gems/aws-s3-0.6.3/lib/aws/s3/extensions.rb:258:in `cattr_accessor'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:155:in `<class:Store>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:154:in `<module:Cache>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:14:in `<module:ActiveSupport>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/cache.rb:12:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder/jbuilder_template.rb:3:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder/railtie.rb:2:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `block in require'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:232:in `load_dependency'
    from /var/lib/gems/1.9.1/gems/activesupport-4.1.5/lib/active_support/dependencies.rb:247:in `require'
    from /var/lib/gems/1.9.1/gems/jbuilder-2.2.5/lib/jbuilder.rb:317:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
    from /var/lib/gems/1.9.1/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
    from /home/rick/rick/Projects/practice/sharebox/config/application.rb:7:in `<top (required)>'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `require'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:79:in `block in server'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `tap'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:76:in `server'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
    from /var/lib/gems/1.9.1/gems/railties-4.1.5/lib/rails/commands.rb:17:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Does anyone know, how to solve this error? Should I try another gem?

like image 428
rick Avatar asked Nov 28 '14 11:11

rick


2 Answers

Yeah i just ran into this issue and resolved. It is because AWS updated their gem to 2.0. If you update the gem to 2.0 different configuration is required according to this article they posted.

If you want to using the version you had before, just change the Gemfile like below:

Gemfile

gem 'aws-sdk', '< 2.0'

like image 87
Omar Sar Avatar answered Oct 03 '22 09:10

Omar Sar


We had the same issue this morning. We already had this aws-sdk gem installed but it was updated to version 2 yesterday. It seems that version 2 doesn't fix this anymore so I advice to use last version 1 : 1.61.0

like image 35
phyzalis Avatar answered Oct 03 '22 11:10

phyzalis