uninitialized constant AuthorizeApiRequest::JsonWebToken

Posted on

Was a weird error.I build fully functioning apps locally before deployment. Locally when running rails server, this error never came up.
When I deployed the app to heroku, I then started receiving that error.
I thought adding “require ‘jwt'” might help, but it didn’t.

This comment by MikaOY pointed me in the right direction:
“Turns out it isn’t a problem with the AuthO implementation, just that libs/ is not included by auto-loaded by default in some versions of Rails.”

Well, I looked in application.rb and I was already autoloading lib. But it pushed me in the right direction.

I specifically had to require_relative the rb file that contained JsonWebToken. Still looking into why that is so, especially since I have a working instance locally. It could just be something with heroku. But hope this helped someone.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s