ip2k / google-api-ruby-client

Automatically exported from code.google.com/p/google-api-ruby-client
Apache License 2.0
0 stars 0 forks source link

TypeError - Can't convert Hash into String or Array. #52

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running DrEdit 
(https://code.google.com/p/google-drive-sdk-samples/source/browse/#hg%2Fruby) 
on Heroku

What is the expected output? What do you see instead?
Unable to save documents.  This stack trace is in the logs:

2012-07-31T16:19:15+00:00 app[web.1]: TypeError - Can't convert Hash into 
String or Array.:
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/lib/addressable/template.r
b:545:in `block in transform_mapping'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/lib/addressable/template.r
b:540:in `each'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/lib/addressable/template.r
b:540:in `inject'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/lib/addressable/template.r
b:540:in `transform_mapping'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/addressable-2.2.8/lib/addressable/template.r
b:456:in `expand'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.4/lib/google/api_clien
t/discovery/method.rb:194:in `generate_uri'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.4/lib/google/api_clien
t/discovery/method.rb:235:in `generate_request'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.4/lib/google/api_clien
t/reference.rb:243:in `to_request'
2012-07-31T16:19:15+00:00 app[web
.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.4/lib/google/api_clien
t.rb:564:in `generate_request'
2012-07-31T16:19:15+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.4/lib/google/api_clien
t.rb:759:in `execute'
2012-07-31T16:19:15+00:00 app[web.1]:   /app/main.rb:224:in `block in <top 
(required)>'

What version of the product are you using? On what operating system?
0.4.4. on heroku

Please provide any additional information below.

Original issue reported on code.google.com by digger...@gmail.com on 31 Jul 2012 at 5:05

GoogleCodeExporter commented 9 years ago
Please see if this error is still present in 0.4.5, since that requires 
Addressable 2.3.2. The latest version of Addressable has a completely replaced 
template codebase.

Original comment by bobaman@google.com on 31 Jul 2012 at 9:50

GoogleCodeExporter commented 9 years ago
I don't think it is an issues with that version of Addressable, though it is 
overly aggressive in trying to transform parameters even if they're not used in 
the template. From the error/code location it looks like one of the values in  
the parameters is a Hash, but can't see where that is coming from. Only thing I 
can think of is the client sending a hash where resource_id should be, but that 
shouldn't be happening either.

digger250 - Did you make any changes to DrEdit? I have it running on heroku 
myself and haven't seen that issue. Could be I have a slightly different 
version deployed than what was checked in to the sample though.

Could you do a little debugging see what the parameters hash contains?

Original comment by sba...@google.com on 1 Aug 2012 at 8:03

GoogleCodeExporter commented 9 years ago
Were you able to check this out on the more recent version of the client yet?

Original comment by bobaman@google.com on 6 Aug 2012 at 10:16

GoogleCodeExporter commented 9 years ago
I checked out a new version of the client and I got this error:

2012-08-07T15:42:57+00:00 app[web.1]: 71.63.159.129 - - [07/Aug/2012 15:42:57] 
"POST /svc?newRevision=true HTTP/1.1" 500 30 0.0058
2012-08-07T15:43:12+00:00 app[web.1]: TypeError - can't convert String into 
Integer:
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.5/lib/google/api_clien
t/reference.rb:66:in `initialize'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.5/lib/google/api_clien
t.rb:764:in `execute'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.5/lib/google/api_clien
t/reference.rb:66:in `[]'
2012-08-07T15:43:12+00:00 app[web.1]:   /app/main.rb:199:in `block in <top 
(required)>'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.5/lib/google/api_clien
t.rb:780:in `execute!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/google-api-client-0.4.5/lib/google/api_clien
t.rb:764:in `new'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:in 
`block in compile!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1212:in 
`call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in 
`[]'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in 
`block (3 levels) in route!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:801:in 
`route_eval'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:785:in 
`block (2 levels) in route!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:822:in 
`block in process_route'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in 
`catch'
2012-08-07T15:43:12+00:00 heroku[router]: POST 
quiet-wave-4746.herokuapp.com/svc?newRevision=true dyno=web.1 queue=0 wait=0ms 
service=9ms status=500 bytes=30
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:820:in 
`process_route'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:784:in 
`block in route!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in 
`each'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:886:in 
`dispatch!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:783:in 
`route!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in 
`block in call!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in 
`block in invoke'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in 
`catch'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:871:in 
`invoke'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:719:in 
`call!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:705:in 
`call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xs
s_header.rb:22:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/ba
se.rb:47:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/pa
th_traversal.rb:16:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/ba
se.rb:47:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/js
on_csrf.rb:17:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/ba
se.rb:47:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-protection-1.2.0/lib/rack/protection/xs
s_header.rb:22:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:2
05:in `context'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:2
00:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/logger.rb:15:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/commonlogger.rb:20:in 
`call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/head.rb:9:in `call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in 
`call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in 
`block in call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1416:in 
`synchronize'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/sinatra-1.3.2/lib/sinatra/base.rb:1334:in 
`call'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:80:in 
`block in pre_process'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in 
`catch'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:78:in 
`pre_process'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:53:in 
`process'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/connection.rb:38:in 
`receive_data'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256
:in `run'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/backends/base.rb:63:in 
`start'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256
:in `run_machine'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/server.rb:159:in `start'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/controllers/controller.r
b:86:in `start'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:151:in `run!'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/lib/thin/runner.rb:185:in 
`run_command'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/gems/thin-1.4.1/bin/thin:6:in `<top (required)>'
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
2012-08-07T15:43:12+00:00 app[web.1]: 71.63.159.129 - - [07/Aug/2012 15:43:12] 
"POST /svc?newRevision=true HTTP/1.1" 500 30 0.0053
2012-08-07T15:43:12+00:00 app[web.1]: 
    /app/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'

Original comment by digger...@gmail.com on 7 Aug 2012 at 3:47

GoogleCodeExporter commented 9 years ago
It appears that `parameters` is defined as an array, but the code tries to 
access it as a hash on line 66:

http://code.google.com/p/google-api-ruby-client/source/browse/lib/google/api_cli
ent/reference.rb?name=google-api-client-0.4.5#66

Original comment by digger...@gmail.com on 7 Aug 2012 at 3:53

GoogleCodeExporter commented 9 years ago
https://github.com/google/google-api-ruby-client/pull/6

Original comment by bobaman@google.com on 21 Aug 2012 at 8:00