grape icon indicating copy to clipboard operation
grape copied to clipboard

uninitialized constant Grape::Middleware::Base::Helpers after update to 1.2.5

Open seb-sykio opened this issue 5 years ago • 6 comments

/.rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/middleware/base.rb:6:in `<class:Base>': uninitialized constant Grape::Middleware::Base::Helpers (NameError)
	from .rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/middleware/base.rb:5:in `<module:Middleware>'
	from .rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/middleware/base.rb:4:in `<module:Grape>'
	from .rvm/gems/ruby-2.6.5/gems/grape-1.2.5/lib/grape/middleware/base.rb:3:in `<top (required)>'
	from .rvm/gems/ruby-2.6.5/gems/grape_logging-1.8.3/lib/grape_logging/middleware/request_logger.rb:1:in `<top (required)>'

seb-sykio avatar Dec 03 '19 12:12 seb-sykio

That's not good. You got a project up that reproduces this? Or bisect it to a change?

dblock avatar Dec 04 '19 03:12 dblock

sorry, nothing online. the only solution I found for now is to remove gem "grape-logging"

seb-sykio avatar Jan 07 '20 21:01 seb-sykio

@dblock @seb-sykio try require 'grape' before require 'grape_logging'

robert-hromej avatar Jan 16 '20 12:01 robert-hromej

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

dblock avatar Jan 16 '20 14:01 dblock

Any updates?

myxoh avatar Feb 03 '20 10:02 myxoh

CC @myxoh

@robert-hromej had the right idea.

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.

pboling avatar Mar 25 '20 18:03 pboling