title: TypeError (no implicit conversion of nil into String) on login when deployed to Heroku
body: <p>I deployed a project to Heroku and am currently getting a "TypeError (no implicit conversion of nil into String)" in my heroku logs when I try and login.</p>
  
  <p>It works fine locally so I am unsure as to what's going wrong.</p>
  
  <pre><code>2017-05-22T09:28:53.701881+00:00 app[web.1]: I, [2017-05-22T09:28:53.701785 #4]  INFO -- : [9748b196-6755-447a-a783-
  03e1d4636790] Completed 500 Internal Server Error in 76ms (ActiveRecord: 1.0ms)
  2017-05-22T09:28:53.624924+00:00 app[web.1]: I, [2017-05-22T09:28:53.624813 #4]  INFO -- : [9748b196-6755-447a-a783-03e1d4636790] Started POST "/login" for 81.154.127.158 at 2017-05-22 09:28:53 +0000
  2017-05-22T09:28:53.702530+00:00 app[web.1]: F, [2017-05-22T09:28:53.702491 #4] FATAL -- : [9748b196-6755-447a-a783-03e1d4636790]   
  2017-05-22T09:28:53.702586+00:00 app[web.1]: F, [2017-05-22T09:28:53.702545 #4] FATAL -- : [9748b196-6755-447a-a783-03e1d4636790] lib/auth.rb:8:in `issue'
  2017-05-22T09:28:53.702441+00:00 app[web.1]: F, [2017-05-22T09:28:53.702368 #4] FATAL -- : [9748b196-6755-447a-a783-03e1d4636790]   
  2017-05-22T09:28:53.702489+00:00 app[web.1]: F, [2017-05-22T09:28:53.702444 #4] FATAL -- : [9748b196-6755-447a-a783-03e1d4636790] TypeError (no implicit conversion of nil into String):
  2017-05-22T09:28:53.702587+00:00 app[web.1]: [9748b196-6755-447a-a783-03e1d4636790] app/controllers/authentications_controller.rb:16:in `login'
  </code></pre>
  
  <p>I think it's saying something is going wrong in either my auth.rb or my auth controller but can't see where.</p>
  
  <p>lib/auth.rb:</p>
  
  <pre><code>  def self.issue(payload, expiry_in_minutes=60*24*30)
     payload[:exp] = expiry_in_minutes.minutes.from_now.to_i
     JWT.encode(payload, auth_secret, ALGORITHM)
    end
  </code></pre>
  
  <p>authentications_controller.rb:</p>
  
  <pre><code>def login
   user = User.find_by_email(params[:email])
   if user &amp;&amp; user.authenticate(params[:password])
     token = Auth.issue({ id: user.id })
     render json: { token: token, user: UserSerializer.new(user) }, status: :ok
   else
     render json: { errors: ["Invalid login credentials."] }, status: 401
   end
  end
  </code></pre>
  
  <p>You can have a look at the full repo <a href="https://github.com/tjallen27/rails-blog-api" rel="nofollow noreferrer">HERE</a> if needed.</p>
  
  <p>Any help would be massively appreciated! </p>