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

ActionDispatch::Http::Parameters::ParseError: 765: unexpected token at '{'id_number': 10858434902}' #30

Closed
huseyin opened this issue Sep 24, 2018 · 5 comments

Comments

@huseyin
Copy link
Contributor

huseyin commented Sep 24, 2018

View details in Rollbar: https://rollbar.com/htkaslan/xokul/items/10/


JSON::ParserError: 765: unexpected token at '{'id_number': 10858434902}'
  File "/app/vendor/ruby-2.5.1/lib/ruby/2.5.0/json/common.rb", line 156, in parse
  File "/app/vendor/ruby-2.5.1/lib/ruby/2.5.0/json/common.rb", line 156, in parse
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/json/decoding.rb", line 23, in decode
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/parameters.rb", line 12, in block in <module:Parameters>
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/parameters.rb", line 112, in parse_formatted_parameters
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/request.rb", line 381, in block in POST
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/request.rb", line 57, in fetch
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/request.rb", line 57, in fetch_header
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/request.rb", line 380, in POST
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/parameters.rb", line 55, in parameters
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb", line 290, in _wrapper_enabled?
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb", line 244, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb", line 24, in process_action
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb", line 134, in process
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb", line 191, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb", line 252, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb", line 52, in dispatch
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb", line 34, in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb", line 52, in block in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb", line 35, in each
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb", line 35, in serve
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb", line 840, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/etag.rb", line 25, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/conditional_get.rb", line 25, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/head.rb", line 12, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb", line 28, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb", line 98, in run_callbacks
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb", line 26, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.17.0/lib/rollbar/middleware/rails/rollbar.rb", line 24, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.17.0/lib/rollbar.rb", line 146, in scoped
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.17.0/lib/rollbar/middleware/rails/rollbar.rb", line 22, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb", line 61, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rollbar-2.17.0/lib/rollbar/middleware/rails/show_exceptions.rb", line 22, in call_with_rollbar
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb", line 33, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb", line 38, in call_app
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb", line 26, in block in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb", line 71, in block in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb", line 28, in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb", line 71, in tagged
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/rack/logger.rb", line 26, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb", line 81, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb", line 27, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/runtime.rb", line 22, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb", line 29, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb", line 14, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb", line 127, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/sendfile.rb", line 111, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/engine.rb", line 524, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/configuration.rb", line 225, in call
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb", line 658, in handle_request
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb", line 472, in process_client
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/server.rb", line 332, in block in run
  File "/app/vendor/bundle/ruby/2.5.0/gems/puma-3.12.0/lib/puma/thread_pool.rb", line 133, in block in spawn_thread
ActionDispatch::Http::Parameters::ParseError: 765: unexpected token at '{'id_number': 10858434902}'
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/parameters.rb", line 117, in rescue in parse_formatted_parameters
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/parameters.rb", line 111, in parse_formatted_parameters
  File "/app/vendor/bundle/ruby/2.5.0/gems/actionpack-5.2.1/lib/action_dispatch/http/request.rb", line 381, in block in POST
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack-2.0.5/lib/rack/request.rb", line 57, in fetch
  File "/app/vendor/bundle/ruby/2.5.0/gems/rack
@huseyin huseyin added the bug label Sep 24, 2018
@msdundar
Copy link
Contributor

Body'yi tek tırnak içinde yollayınca geldi. Yani "id_number" yerine 'id_number' yolladım :)

@huseyin
Copy link
Contributor Author

huseyin commented Sep 24, 2018

@msdundar JSON parser tek tırnak parse edemez. Client-side bir hata bu

@huseyin
Copy link
Contributor Author

huseyin commented Sep 24, 2018

Bence burdaki sorun Content-Type içeriğinde.

Content-Type   text/html; charset=UTF-8

Bunu fix'lemek gerek.

@msdundar
Copy link
Contributor

Gelen request'te text/html varsa o deneme yaparken olmuştur, normalde application/json

@huseyin
Copy link
Contributor Author

huseyin commented Sep 24, 2018

text/html response'da bir ayar yapmak gerekebilir. "content-type application/json by default in rails 5" gibi bir arama yapmam lazım. sanırım yönetmediğim hatalarda default'u kullanıyor

@huseyin huseyin mentioned this issue Sep 25, 2018
4 tasks
@huseyin huseyin mentioned this issue Sep 25, 2018
4 tasks
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

2 participants