Sheharyar
Sheharyar

Reputation: 75740

Can't start Rails server with aws-sdk gem

I've to use the aws-sdk gem in my rails application. The problem is that whenever I add it to my gemfile, the rails server does not start and gives me the following error:

$ rails s
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /home/psycho/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:108:in `load_yaml_config'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:54:in `setup'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/aws-sdk-1.29.0/lib/aws/rails.rb:26:in `block in <class:Railtie>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/psycho/Desktop/filesdroid/config/environment.rb:5:in `<top (required)>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `block in require'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/activesupport-3.2.3/lib/active_support/dependencies.rb:251:in `require'
    from /home/psycho/Desktop/filesdroid/config.ru:3:in `block in <main>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
    from /home/psycho/Desktop/filesdroid/config.ru:in `new'
    from /home/psycho/Desktop/filesdroid/config.ru:in `<main>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /home/psycho/.rvm/gems/ruby-1.9.3-p448/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

It clearly points to line 5 of my environment.rb. I've checked and there's nothing there:

# Load the rails application
require File.expand_path('../application', __FILE__)

# Initialize the rails application
FilesDroid::Application.initialize!    # Line 5

It's simply an initialize call. This doesn't happen if I remove aws-sdk from my gemfile. Help, please?

Upvotes: 1

Views: 358

Answers (1)

Alex.Bullard
Alex.Bullard

Reputation: 5563

Psych is a yaml parser, and it looks like it is trying to parse an incorrectly formatted yaml file:

(<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1 (Psych::SyntaxError)

I happen to know that the aws-sdk gem attempts to read aws credentials from config/aws.yml. Do you have a file located there and is it correctly formatted?

Upvotes: 2

Related Questions