DEV Community


Posted on

deploying rails showing error "Missing encryption key".

I am using rails credentials in production. Like the following image. But when i am trying to upload it to digitalocean, it is showing errors

Rake aborted!
01 NoMethodError: undefined method `[]' for nil:NilClass

Where is the problem in this code?

This is my credential structure, and i am calling those credentials with the following.

:user_name => Rails.application.credentials.sendgrid[:user_name],
:password => Rails.application.credentials.sendgrid[:password],

How can i solve this problem?

Top comments (2)

ehsanatwork profile image

I have got the solution.
By adding the master key to the production.
these following tuts really help me to get out of this problem.

talk2megooseman profile image
Erik Guzman

I would highly recommend keeping your master key in a secure place. Making a private Github GIST would do the trick. You want to have it securely stored in cases where you need to clone your repo to another computer or some freak accident happens that causes you to lose your master key.