Rails credentials in Travis: undefined method `[]' for nil:NilClass

my credentials are store as such

  key_secret: <key>
  key_secret: <key>

Travis does not pick this information, when tests start running, then it beaks the build.

Failure/Error: HMAC_SECRET = Rails.application.credentials[Rails.env.to_sym][:key_secret]
  undefined method `[]' for nil:NilClass

You need to add the following in your before_install in your .travis.yml:

- echo "$RAILS_MASTER_KEY" > config/master.key

That should solve it for you.

1 Like

as always @montana!

No problem, glad I could solve your problem.

1 Like