Search code examples
ruby-on-railsnitrousio

Internal Server Error: undefined method `symbolize_keys' for #<String:0x0000000589bde0>


I hate to ask a question that looks like it's been asked so many times before, but my situation seems to be different. I'm using nitrous.io as my development environment, and when I try to preview my app, I get this error message.

The trace is: ERROR NoMethodError: undefined method symbolize_keys' for #<String:0x0000000476d9b0>
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:327:in
secrets'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:461:in validate_secret_key_config!'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:195:in
env_config'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/engine.rb:510:in call'
/home/action/.rvm/gems/ruby-2.1.5/gems/railties-4.1.8/lib/rails/application.rb:144:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/lock.rb:17:in call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/content_length.rb:14:in
call'
/home/action/.rvm/gems/ruby-2.1.5/gems/rack-1.5.2/lib/rack/handler/webrick.rb:60:in service'
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
service'
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/httpserver.rb:94:in run'
/home/action/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/webrick/server.rb:295:in
block in start_thread'

I imagine there's a problem with my secret key, but I can't tell what it is. I don't even know what other information to put here!

If anyone has any kind of an idea, I'd appreciate your input . . .


Solution

  • SPACE - your problem is a lack of a space char.

    WRONG: secret_key_base:afcb44c
    CORRECT: secret_key_base: afcb44c
    

    check your config/secrets.yml, it should be something like that:

    # Be sure to restart your server when you modify this file.
    
    # Your secret key is used for verifying the integrity of signed cookies.
    # If you change this key, all old signed cookies will become invalid!
    
    # Make sure the secret is at least 30 characters and all random,
    # no regular words or you'll be exposed to dictionary attacks.
    # You can use `rake secret` to generate a secure secret key.
    
    # Make sure the secrets in this file are kept private
    # if you're sharing your code publicly.
    
    production:
      secret_key_base: 59834597551c797b02cd5bb3edd7439f7a9c604bc82531d51d6e5f995e6ea849deb545df53213c5fd2ce4d698edfca65c8aa1b4e0fbadd884efefae0348b079b
    
    development:
      secret_key_base: aea4705f645128e053daf1f8511014aca3b1e28323c3ece75f228540fb310869a6c4aeac172783d1c5c8ec9c5fe9b7f7af9a0204714db29e1d2a6709fca65ebf
    
    test:
      secret_key_base: afcb44cfa8eab1f23d19b87e327d0fcc42e7c1d2c681812b346b57901ddb2511ebde569a1b868da367e2de14554c648f723a30de3daada015bbd0b268beeda3b
    
    # Do not keep production secrets in the repository,
    # instead read values from the environment.
    # production:
    #   secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
    

    Also, if you need to generate new keys, do with the command: rake secret

    So please, don't forget to add a space after ":".