ruby-grape / ruby-grape/grape

Unexpected error while processing request: undefined method `downcase' for 2:Fixnum

Open
#1,059 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug?
Dominant language
Ruby
Stars
10k
Forks
1.2k
Avg merge
14h 38m
Merged PRs (30d)
92

Description

My Grape API is not working with grape v0.11.0 nor grape v0.12.0
Working with grape v0.10.0

I am using Rack Cascasde to load my API, ApiDoc with grape_swagger and my statics files
Using grape-activerecord v0.0.8, grape-entity 0.4.5 and grape-swagger 0.10.1

My database connection is loaded before invoking the API

It's only on the first GET that it fails
And it's difficult to see why and where in my project with this kind of trace !

Unexpected error while processing request: undefined method `downcase' for 2:Fixnum
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/utils.rb:501:in `[]'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/response.rb:53:in `[]'
    /var/lib/gems/2.1.0/gems/activerecord-4.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:650:in `call'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/middleware/error.rb:27:in `block in call!'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/middleware/error.rb:26:in `catch'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/middleware/error.rb:26:in `call!'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/middleware/base.rb:18:in `call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/endpoint.rb:196:in `call!'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/endpoint.rb:184:in `call'
    /var/lib/gems/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'
    /var/lib/gems/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'
    /var/lib/gems/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:68:in `optimized_each'
    /var/lib/gems/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'
    /var/lib/gems/2.1.0/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/api.rb:98:in `call'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/api.rb:33:in `call!'
    /var/lib/gems/2.1.0/gems/grape-0.12.0/lib/grape/api.rb:29:in `call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/cascade.rb:33:in `block in call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/cascade.rb:24:in `each'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/cascade.rb:24:in `call'
    /var/lib/gems/2.1.0/gems/rack-contrib-1.3.0/lib/rack/contrib/post_body_content_type_parser.rb:36:in `call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/commonlogger.rb:33:in `call'
    /var/lib/gems/2.1.0/gems/sinatra-1.4.6/lib/sinatra/base.rb:218:in `call'
    /var/lib/gems/2.1.0/gems/rack-1.6.4/lib/rack/deflater.rb:35:in `call'
    /var/lib/gems/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:86:in `block in pre_process'
    /var/lib/gems/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `catch'
    /var/lib/gems/2.1.0/gems/thin-1.6.3/lib/thin/connection.rb:84:in `pre_process'
    /var/lib/gems/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:1054:in `call'
    /var/lib/gems/2.1.0/gems/eventmachine-1.0.7/lib/eventmachine.rb:1054:in `block in spawn_threadpool'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the first GET with Grape 0.11.0 or 0.12.0 and the listed Rack, ActiveRecord, and middleware versions. Start at rack/utils.rb:501 and rack/response.rb:53, then follow the Grape error path in grape/middleware/error.rb; done means the request no longer raises the reported Fixnum downcase error and its cause is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.