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

NoMethodError (undefined method `[]' for nil:NilClass) after updating to 0.34.1 #771

Closed
charger opened this issue Jan 13, 2020 · 5 comments

Comments

@charger
Copy link

charger commented Jan 13, 2020

After updating gem to 0.34.0 or 0.34.1 I got an error when visit http://localhost:3000/api/swagger_doc

NoMethodError (undefined method `[]' for nil:NilClass):
  
grape (1.2.5) lib/grape/router.rb:163:in `cascade?'
grape (1.2.5) lib/grape/router.rb:95:in `transaction'
grape (1.2.5) lib/grape/router.rb:72:in `identity'
...

The code in gem:

    def cascade?(response)
      response && response[1][Grape::Http::Headers::X_CASCADE] == 'pass'
    end

response[1] is nil

Which additional information I can provide?

@LeFnord
Copy link
Member

LeFnord commented Jan 13, 2020

is it related to #767 ?

@charger
Copy link
Author

charger commented Jan 14, 2020

It's hard to say if these two issues are related. They are both actual but occur in different places.
The issue in question occurs if I update grape-swagger to 0.34:

NoMethodError (undefined method `[]' for nil:NilClass):
grape (1.2.5) lib/grape/router.rb:163:in `cascade?'

I don't encountered the #767, but if I add target_class: ::Map::API to my add_swagger_documentation I got error even using old grape-swagger 0.33:

Uncaught exception: undefined method `unshift' for nil:NilClass
~/.rvm/gems/ruby-2.6.3/gems/grape-swagger-0.33.0/lib/grape-swagger.rb:40:in `block in combine_routes'

@hgeorgilas
Copy link

Got the same error, I think it's related to ruby-grape/grape #1966.
But gemspec file won't let me upgrade to grape 1.3.0

@LeFnord
Copy link
Member

LeFnord commented Jan 20, 2020

yeap the failure is rack based → a workaround is to fix it to version 2.0.8, see also this grape#1980

@LeFnord
Copy link
Member

LeFnord commented Jan 20, 2020

had to freeze the rack version for the moment → 0.34.2

updating to grape >= 1.3.0 will be possible with the next release, see: #768 (comment)

@LeFnord LeFnord closed this as completed Jan 20, 2020
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

3 participants