Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: uninitialized constant Grape::Middleware::Base::Helpers #69

Open
pboling opened this issue Mar 25, 2020 · 0 comments
Open

NameError: uninitialized constant Grape::Middleware::Base::Helpers #69

pboling opened this issue Mar 25, 2020 · 0 comments

Comments

@pboling
Copy link

pboling commented Mar 25, 2020

Ref: ruby-grape/grape#1939 (comment)

Here is the complete stack:

NameError: uninitialized constant Grape::Middleware::Base::Helpers
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape-1.3.1/lib/grape/middleware/base.rb:8:in `<class:Base>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape-1.3.1/lib/grape/middleware/base.rb:7:in `<module:Middleware>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape-1.3.1/lib/grape/middleware/base.rb:6:in `<module:Grape>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape-1.3.1/lib/grape/middleware/base.rb:5:in `<top (required)>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb:1:in `require'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb:1:in `<top (required)>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape_logging-1.8.3/lib/grape_logging.rb:16:in `require'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/grape_logging-1.8.3/lib/grape_logging.rb:16:in `<top (required)>'
  config.ru:3:in `require'
  config.ru:3:in `block in <main>'
  /Users/pboling/.asdf/installs/ruby/2.5.7/lib/ruby/gems/2.5.0/gems/rack-2.2.2/lib/rack/builder.rb:116:in `eval'

Removing grape_logging from the project fixes the issue. @dblock says:

If this fixes that feels like grape_logging should be doing a require 'grape'. Open an issue in that repo.

Seems like this repo needs to require 'grape' somewhere.

UPDATE: If I move require 'grape_logging' to spot in the load order after I am sure grape has been loaded, then this error goes away. This gem, as is, doesn't load grape properly on it's own, but allowing bundler to load grape works.

In other words, if I have a require 'grape_logging' early on, before bundler loads my environment, then I get this error with latest version of grape.

Hat tip to @robert-hromej who had the right idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant