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

"not opened for reading" on ams > 0.9.3 #1038

Closed
johnhamelink opened this issue Aug 5, 2015 · 9 comments
Closed

"not opened for reading" on ams > 0.9.3 #1038

johnhamelink opened this issue Aug 5, 2015 · 9 comments

Comments

@johnhamelink
Copy link
Contributor

Hey there,

I'm working on a new API project where I'm using AMS with Grape and Swagger-UI. I wanted to use the 0.10.0 release candidates so I could utilize JSON-API in full while building my API. However in both 0.10.0.rc1, 0.10.0.rc2, and git master I get the following error when trying to serialize (JSON output from Swagger UI):

Stack Trace:

[
  "not opened for reading",
  [
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:128:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:128:in `to_a'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:128:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:48:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:140:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `block in as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `map'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:159:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:50:in `as_json'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/json/encoding.rb:35:in `encode'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/json/encoding.rb:22:in `encode'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'",
    "/Users/john/.gem/ruby/2.2.2/bundler/gems/grape-active_model_serializers-ca9c8faaa997/lib/grape-active_model_serializers/formatter.rb:9:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/formatter.rb:34:in `block in after'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/formatter.rb:33:in `collect'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/formatter.rb:33:in `after'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/base.rb:25:in `call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/base.rb:18:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/base.rb:24:in `call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/base.rb:18:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/error.rb:27:in `block in call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/error.rb:26:in `catch'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/error.rb:26:in `call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/middleware/base.rb:18:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/endpoint.rb:196:in `call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/endpoint.rb:184:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:152:in `block in call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:96:in `block in recognize'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:68:in `optimized_each'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-mount-0.8.3/lib/rack/mount/code_generation.rb:95:in `recognize'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-mount-0.8.3/lib/rack/mount/route_set.rb:141:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/api.rb:98:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/api.rb:33:in `call!'",
    "/Users/john/.gem/ruby/2.2.2/gems/grape-0.12.0/lib/grape/api.rb:29:in `call'",
    "/Users/john/Public/fap/fap-2.0/api/src/app/api/fap/logger.rb:11:in `block in call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/notifications.rb:166:in `instrument'",
    "/Users/john/Public/fap/fap-2.0/api/src/app/api/fap/logger.rb:10:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/builder.rb:153:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/routing/mapper.rb:51:in `serve'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:43:in `block in serve'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `each'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/journey/router.rb:30:in `serve'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/routing/route_set.rb:821:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/bullet-4.14.7/lib/bullet/rack.rb:12:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/tld_length-1.0.0/lib/rack/tld_length.rb:16:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'",
    "/Users/john/.gem/ruby/2.2.2/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'",
    "/Users/john/.gem/ruby/2.2.2/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/etag.rb:24:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/conditionalget.rb:38:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/head.rb:13:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/params_parser.rb:27:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/flash.rb:260:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:225:in `context'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/session/abstract/id.rb:220:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/cookies.rb:560:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activerecord-4.2.3/lib/active_record/query_cache.rb:36:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:377:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/callbacks.rb:84:in `run_callbacks'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/callbacks.rb:27:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/reloader.rb:73:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/remote_ip.rb:78:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/railties-4.2.3/lib/rails/rack/logger.rb:38:in `call_app'",
    "/Users/john/.gem/ruby/2.2.2/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `block in call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `block in tagged'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:26:in `tagged'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/tagged_logging.rb:68:in `tagged'",
    "/Users/john/.gem/ruby/2.2.2/gems/railties-4.2.3/lib/rails/rack/logger.rb:20:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/request_id.rb:21:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/methodoverride.rb:22:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/runtime.rb:18:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/activesupport-4.2.3/lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/lock.rb:17:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/actionpack-4.2.3/lib/action_dispatch/middleware/static.rb:116:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/sendfile.rb:113:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/railties-4.2.3/lib/rails/engine.rb:518:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/railties-4.2.3/lib/rails/application.rb:165:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/rack-1.6.4/lib/rack/content_length.rb:15:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/puma-2.12.3/lib/puma/server.rb:541:in `handle_request'",
    "/Users/john/.gem/ruby/2.2.2/gems/puma-2.12.3/lib/puma/server.rb:388:in `process_client'",
    "/Users/john/.gem/ruby/2.2.2/gems/puma-2.12.3/lib/puma/server.rb:270:in `block in run'",
    "/Users/john/.gem/ruby/2.2.2/gems/puma-2.12.3/lib/puma/thread_pool.rb:106:in `call'",
    "/Users/john/.gem/ruby/2.2.2/gems/puma-2.12.3/lib/puma/thread_pool.rb:106:in `block in spawn_thread'"
  ]
]

My Gemfile.lock:

GIT
  remote: https://github.com/jrhe/grape-active_model_serializers.git
  revision: ca9c8faaa99727300ff21419aa20471ac27eed42
  specs:
    grape-active_model_serializers (1.3.1)
      active_model_serializers (>= 0.9.0)
      grape

GEM
  remote: https://rubygems.org/
  specs:
    actionmailer (4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 1.0, >= 1.0.5)
    actionpack (4.2.3)
      actionview (= 4.2.3)
      activesupport (= 4.2.3)
      rack (~> 1.6)
      rack-test (~> 0.6.2)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
      erubis (~> 2.7.0)
      rails-dom-testing (~> 1.0, >= 1.0.5)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    active_model_serializers (0.10.0.rc2)
      activemodel (>= 4.0)
    activejob (4.2.3)
      activesupport (= 4.2.3)
      globalid (>= 0.3.0)
    activemodel (4.2.3)
      activesupport (= 4.2.3)
      builder (~> 3.1)
    activerecord (4.2.3)
      activemodel (= 4.2.3)
      activesupport (= 4.2.3)
      arel (~> 6.0)
    activesupport (4.2.3)
      i18n (~> 0.7)
      json (~> 1.7, >= 1.7.7)
      minitest (~> 5.1)
      thread_safe (~> 0.3, >= 0.3.4)
      tzinfo (~> 1.1)
    arel (6.0.3)
    awesome_print (1.6.1)
    axiom-types (0.1.1)
      descendants_tracker (~> 0.0.4)
      ice_nine (~> 0.11.0)
      thread_safe (~> 0.3, >= 0.3.1)
    bcrypt (3.1.10)
    builder (3.2.2)
    bullet (4.14.7)
      activesupport (>= 3.0.0)
      uniform_notifier (~> 1.9.0)
    choice (0.2.0)
    coderay (1.1.0)
    coercible (1.0.0)
      descendants_tracker (~> 0.0.1)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    devise (3.5.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 3.2.6, < 5)
      responders
      thread_safe (~> 0.1)
      warden (~> 1.2.3)
    equalizer (0.0.11)
    erubis (2.7.0)
    foreman (0.78.0)
      thor (~> 0.19.1)
    globalid (0.3.6)
      activesupport (>= 4.1.0)
    grape (0.12.0)
      activesupport
      builder
      hashie (>= 2.1.0)
      multi_json (>= 1.3.2)
      multi_xml (>= 0.5.2)
      rack (>= 1.3.0)
      rack-accept
      rack-mount
      virtus (>= 1.0.0)
    grape-entity (0.4.7)
      activesupport
      multi_json (>= 1.3.2)
    grape-kaminari (0.1.8)
      grape
      kaminari
    grape-swagger (0.10.1)
      grape (>= 0.8.0)
      grape-entity
    grape-swagger-rails (0.1.0)
      grape-swagger (>= 0.7.2)
      railties (>= 3.2.12)
    hashie (3.4.2)
    i18n (0.7.0)
    ice_nine (0.11.1)
    json (1.8.3)
    kaminari (0.16.3)
      actionpack (>= 3.0.0)
      activesupport (>= 3.0.0)
    loofah (2.0.2)
      nokogiri (>= 1.5.9)
    mail (2.6.3)
      mime-types (>= 1.16, < 3)
    method_source (0.8.2)
    mime-types (2.6.1)
    mini_portile (0.6.2)
    minitest (5.7.0)
    multi_json (1.11.2)
    multi_xml (0.5.5)
    nokogiri (1.6.6.2)
      mini_portile (~> 0.6.0)
    orm_adapter (0.5.0)
    pg (0.18.2)
    pry (0.10.1)
      coderay (~> 1.1.0)
      method_source (~> 0.8.1)
      slop (~> 3.4)
    puma (2.12.3)
    rack (1.6.4)
    rack-accept (0.4.5)
      rack (>= 0.4)
    rack-cors (0.4.0)
    rack-mount (0.8.3)
      rack (>= 1.0.0)
    rack-test (0.6.3)
      rack (>= 1.0)
    rails (4.2.3)
      actionmailer (= 4.2.3)
      actionpack (= 4.2.3)
      actionview (= 4.2.3)
      activejob (= 4.2.3)
      activemodel (= 4.2.3)
      activerecord (= 4.2.3)
      activesupport (= 4.2.3)
      bundler (>= 1.3.0, < 2.0)
      railties (= 4.2.3)
      sprockets-rails
    rails-deprecated_sanitizer (1.0.3)
      activesupport (>= 4.2.0.alpha)
    rails-dom-testing (1.0.6)
      activesupport (>= 4.2.0.beta, < 5.0)
      nokogiri (~> 1.6.0)
      rails-deprecated_sanitizer (>= 1.0.1)
    rails-erd (1.4.1)
      activerecord (>= 3.2)
      activesupport (>= 3.2)
      choice (~> 0.2.0)
      ruby-graphviz (~> 1.2)
    rails-html-sanitizer (1.0.2)
      loofah (~> 2.0)
    rails_12factor (0.0.3)
      rails_serve_static_assets
      rails_stdout_logging
    rails_serve_static_assets (0.0.4)
    rails_stdout_logging (0.0.3)
    railties (4.2.3)
      actionpack (= 4.2.3)
      activesupport (= 4.2.3)
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (10.4.2)
    redcarpet (3.3.2)
    responders (2.1.0)
      railties (>= 4.2.0, < 5)
    rouge (1.9.1)
    ruby-graphviz (1.2.2)
    slop (3.6.0)
    spring (1.3.6)
    sprockets (3.2.0)
      rack (~> 1.0)
    sprockets-rails (2.3.2)
      actionpack (>= 3.0)
      activesupport (>= 3.0)
      sprockets (>= 2.8, < 4.0)
    thor (0.19.1)
    thread_safe (0.3.5)
    tld_length (1.0.0)
    tzinfo (1.2.2)
      thread_safe (~> 0.1)
    uniform_notifier (1.9.0)
    virtus (1.0.5)
      axiom-types (~> 0.1)
      coercible (~> 1.0)
      descendants_tracker (~> 0.0, >= 0.0.3)
      equalizer (~> 0.0, >= 0.0.9)
    warden (1.2.3)
      rack (>= 1.0)

PLATFORMS
  ruby

DEPENDENCIES
  active_model_serializers (~> 0.10.0.rc1)
  awesome_print
  bcrypt (~> 3.1.7)
  bullet
  devise
  foreman
  grape (~> 0.12.0)
  grape-active_model_serializers!
  grape-kaminari (~> 0.1.8)
  grape-swagger (~> 0.10.1)
  grape-swagger-rails (~> 0.1.0)
  pg
  pry
  puma
  rack-cors
  rails (= 4.2.3)
  rails-erd
  rails_12factor
  redcarpet
  rouge
  spring
  tld_length

BUNDLED WITH
   1.10.6

Example code which causes this error:

app/api/fap/v1/sessions/sso.rb:

module Fap::V1::Sessions
  class Sso < Grape::API
    include Fap::V1::Defaults

    resource :sso do

      desc 'Facebook Login', SwaggerHelper.requires_accept_header
      params do
        optional :oauth_access_token, type: String, desc: 'OAuth Access Token'
      end
      post :facebook do
        render Session.first
      end
     end
end
end

app/api/fap/v1/defaults.rb:

module Fap::V1::Defaults
  extend ActiveSupport::Concern

  included do
    version 'v1', using: :header, vendor: 'fap'
    format :json
    content_type :json, 'application/json'
    formatter :json, Grape::Formatter::ActiveModelSerializers

    include Grape::Kaminari
    include Fap::V1::Concerns::Errors
    include Fap::V1::Concerns::Swagger
    include Fap::V1::Concerns::UserState
  end

end
@joaomdmoura
Copy link
Member

Hey @johnhamelink, first of all I'm really glad to hear the you are building cutting-edge API's! 😄
Some ppl have already reported errors involving ams + grape-active_model_serializers but only when related to cache, this is the first time I see something like it.
I'll try to replicate it, but please if anyone else have some experience with grape make yourself comfortable to share with us your thoughts.

@johnhamelink
Copy link
Contributor Author

Cheers! We're using 0.9.3 right now to get started, but we'll want to switch over to 0.10 asap so we don't need to rewrite too much client side code :)

Let me know if there's anything I can do to help!

@joaomdmoura joaomdmoura removed this from the 0.10 milestone Aug 17, 2015
@r2k1
Copy link

r2k1 commented Sep 17, 2015

I have the same error with rails 4.2 and AMS 0.10.0.rc3

Hard to say where is exactly this problem, as I have similar serialisation logic and this error appears only during rendering particular models.

Full Trace
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:128:in `each'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:128:in `to_a'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:128:in `as_json'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `block in as_json'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `each'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `map'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `as_json'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `block in as_json'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `each'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `map'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:159:in `as_json'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:50:in `as_json'
activesupport (4.2.4) lib/active_support/json/encoding.rb:95:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `block in jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `each'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `map'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `block in jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `each'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `map'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `block in jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `each'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `map'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `block in jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `each'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `map'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `block in jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `each'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `map'
activesupport (4.2.4) lib/active_support/json/encoding.rb:91:in `jsonify'
activesupport (4.2.4) lib/active_support/json/encoding.rb:35:in `encode'
activesupport (4.2.4) lib/active_support/json/encoding.rb:22:in `encode'
activesupport (4.2.4) lib/active_support/core_ext/object/json.rb:37:in `to_json_with_active_support_encoder'
actionpack (4.2.4) lib/action_controller/metal/renderers.rb:116:in `block in <module:Renderers>'
active_model_serializers (0.10.0.rc3) lib/action_controller/serialization.rb:51:in `block (2 levels) in <module:Serialization>'
actionpack (4.2.4) lib/action_controller/metal/renderers.rb:45:in `block in _render_to_body_with_renderer'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/set.rb:283:in `each_key'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/set.rb:283:in `each'
actionpack (4.2.4) lib/action_controller/metal/renderers.rb:41:in `_render_to_body_with_renderer'
actionpack (4.2.4) lib/action_controller/metal/renderers.rb:37:in `render_to_body'
actionpack (4.2.4) lib/abstract_controller/rendering.rb:25:in `render'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block (2 levels) in render'
activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/usr/local/opt/rbenv/versions/2.2.2/lib/ruby/2.2.0/benchmark.rb:303:in `realtime'
activesupport (4.2.4) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:44:in `block in render'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:87:in `cleanup_view_runtime'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:43:in `render'
responders (2.1.0) lib/action_controller/responder.rb:145:in `render'
app/responders/api_responder.rb:7:in `to_json'
responders (2.1.0) lib/action_controller/responder.rb:163:in `respond'
responders (2.1.0) lib/action_controller/responder.rb:156:in `call'
responders (2.1.0) lib/action_controller/respond_with.rb:203:in `respond_with'
app/controllers/addons/activities_controller.rb:13:in `show'
actionpack (4.2.4) lib/abstract_controller/base.rb:198:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:20:in `block in process_action'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:117:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:555:in `block (2 levels) in compile'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:505:in `call'
activesupport (4.2.4) lib/active_support/callbacks.rb:92:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/abstract_controller/callbacks.rb:19:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:32:in `block in process_action'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `block in instrument'
activesupport (4.2.4) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.2.4) lib/active_support/notifications.rb:164:in `instrument'
actionpack (4.2.4) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.2.4) lib/abstract_controller/base.rb:137:in `process'
actionview (4.2.4) lib/action_view/rendering.rb:30:in `process'
actionpack (4.2.4) lib/action_controller/metal.rb:196:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.2.4) lib/action_controller/metal.rb:237:in `block in action'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `call'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:76:in `dispatch'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:45:in `serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:43:in `block in serve'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `each'
actionpack (4.2.4) lib/action_dispatch/journey/router.rb:30:in `serve'
actionpack (4.2.4) lib/action_dispatch/routing/route_set.rb:821:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.6.4) lib/rack/etag.rb:24:in `call'
rack (1.6.4) lib/rack/conditionalget.rb:25:in `call'
rack (1.6.4) lib/rack/head.rb:13:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.2.4) lib/active_support/callbacks.rb:88:in `__run_callbacks__'
activesupport (4.2.4) lib/active_support/callbacks.rb:778:in `_run_call_callbacks'
activesupport (4.2.4) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (4.2.4) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/reloader.rb:73:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/remote_ip.rb:78:in `call'
rollbar (2.2.1) lib/rollbar/middleware/rails/rollbar.rb:24:in `block in call'
rollbar (2.2.1) lib/rollbar.rb:837:in `scoped'
rollbar (2.2.1) lib/rollbar/middleware/rails/rollbar.rb:22:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
rollbar (2.2.1) lib/rollbar/middleware/rails/show_exceptions.rb:22:in `call_with_rollbar'
actionpack (4.2.4) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.2.4) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `block in tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:26:in `tagged'
activesupport (4.2.4) lib/active_support/tagged_logging.rb:68:in `tagged'
railties (4.2.4) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.6.4) lib/rack/runtime.rb:18:in `call'
activesupport (4.2.4) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
rack (1.6.4) lib/rack/lock.rb:17:in `call'
actionpack (4.2.4) lib/action_dispatch/middleware/static.rb:116:in `call'
railties (4.2.4) lib/rails/engine.rb:518:in `call'
railties (4.2.4) lib/rails/application.rb:165:in `call'
rack (1.6.4) lib/rack/content_length.rb:15:in `call'
puma (2.13.4) lib/puma/server.rb:541:in `handle_request'
puma (2.13.4) lib/puma/server.rb:388:in `process_client'
puma (2.13.4) lib/puma/server.rb:270:in `block in run'
puma (2.13.4) lib/puma/thread_pool.rb:106:in `call'
puma (2.13.4) lib/puma/thread_pool.rb:106:in `block in spawn_thread'

@r2k1
Copy link

r2k1 commented Sep 17, 2015

For my case it seems, like it also related to #963. But I'm using mongoid, so relation probably handles in a different way. Renaming has_many :options solved my problem

@bf4
Copy link
Member

bf4 commented Oct 8, 2015

Also, grape-ams doesn't work with the current version of ams

@bf4 bf4 mentioned this issue Oct 8, 2015
@hut8
Copy link
Contributor

hut8 commented Oct 23, 2015

@bf4 seems like you're always a couple days ahead of me! I am getting the same error as @yokree with the same versions just FYI. Grape support would be awesome.

@bf4
Copy link
Member

bf4 commented Nov 26, 2015

I think this has been addressed and may be closed?

@johnhamelink
Copy link
Contributor Author

@bf4 yep! Closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants