graphql-pundit icon indicating copy to clipboard operation
graphql-pundit copied to clipboard

Class based API throws `wrong number of arguments (given 2, expected 4)`

Open maxhungry opened this issue 5 years ago • 0 comments

A minimal setup with field_class GraphQL::Pundit::Field, here's the repro: https://github.com/maxhungry/graphql-pundit-args

stacktrace:

Started POST "/graphql" for ::1 at 2018-10-02 18:25:30 +1300
Processing by GraphqlController#execute as */*
  Parameters: {"query"=>"{\n\ttestField\n}", "graphql"=>{"query"=>"{\n\ttestField\n}"}}
wrong number of arguments (given 2, expected 4)
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-pundit-0.7.1/lib/graphql-pundit/scope.rb:37:in `apply_scope'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema/field.rb:353:in `block in resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema.rb:1013:in `after_lazy'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema/field.rb:338:in `resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-pundit-0.7.1/lib/graphql-pundit/scope.rb:31:in `resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-pundit-0.7.1/lib/graphql-pundit/authorization.rb:41:in `resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/field.rb:248:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/field.rb:248:in `resolve'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:295:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema/middleware_chain.rb:49:in `invoke_core'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema/middleware_chain.rb:38:in `invoke'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:108:in `block in resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `block in trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:76:in `call_tracers'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:107:in `resolve_field'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:71:in `block in resolve_selection'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:64:in `each'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:64:in `resolve_selection'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:36:in `block in resolve_root_selection'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `block in trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:76:in `call_tracers'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/execute.rb:32:in `resolve_root_selection'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:108:in `begin_query'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:81:in `block in run_as_multiplex'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:80:in `map'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:80:in `run_as_multiplex'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:69:in `block (2 levels) in run_queries'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:174:in `block in instrument_and_analyze'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:29:in `block (2 levels) in apply_instrumenters'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:46:in `block (2 levels) in each_query_call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:41:in `each_query_call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:45:in `block in each_query_call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:70:in `call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:44:in `each_query_call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:27:in `block in apply_instrumenters'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:70:in `call_hooks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/instrumentation.rb:26:in `apply_instrumenters'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:166:in `instrument_and_analyze'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:68:in `block in run_queries'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `block in trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:76:in `call_tracers'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/tracing.rb:62:in `trace'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:58:in `run_queries'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/execution/multiplex.rb:48:in `run_all'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema.rb:342:in `block in multiplex'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema.rb:1079:in `with_definition_error_check'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema.rb:341:in `multiplex'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/graphql-1.8.10/lib/graphql/schema.rb:318:in `execute'
/Users/maxhung/development/ruby/graphql-pundit-args/app/controllers/graphql_controller.rb:10:in `execute'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:194:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/rendering.rb:30:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:42:in `block in process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:132:in `run_callbacks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/abstract_controller/callbacks.rb:41:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/rescue.rb:22:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `block in instrument'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/notifications.rb:168:in `instrument'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/instrumentation.rb:32:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activerecord-5.2.1/lib/active_record/railties/controller_runtime.rb:24:in `process_action'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/abstract_controller/base.rb:134:in `process'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionview-5.2.1/lib/action_view/rendering.rb:32:in `process'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:191:in `dispatch'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_controller/metal.rb:252:in `dispatch'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:34:in `serve'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:52:in `block in serve'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `each'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/journey/router.rb:35:in `serve'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/routing/route_set.rb:840:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/tempfile_reaper.rb:15:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/etag.rb:25:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/conditional_get.rb:38:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/head.rb:12:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/http/content_security_policy.rb:18:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:232:in `context'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/session/abstract/id.rb:226:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/cookies.rb:670:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activerecord-5.2.1/lib/active_record/migration.rb:559:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:98:in `run_callbacks'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/callbacks.rb:26:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:135:in `call_app'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30:in `block in call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `catch'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:38:in `call_app'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:26:in `block in call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:71:in `block in tagged'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:28:in `tagged'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/tagged_logging.rb:71:in `tagged'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/rack/logger.rb:26:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/quiet_assets.rb:13:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/request_id.rb:27:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/method_override.rb:22:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/runtime.rb:22:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/activesupport-5.2.1/lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/executor.rb:14:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/actionpack-5.2.1/lib/action_dispatch/middleware/static.rb:127:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/rack-2.0.5/lib/rack/sendfile.rb:111:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:524:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/configuration.rb:225:in `call'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/server.rb:658:in `handle_request'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/server.rb:472:in `process_client'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/server.rb:332:in `block in run'
/Users/maxhung/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/puma-3.12.0/lib/puma/thread_pool.rb:133:in `block in spawn_thread'
Completed 500 Internal Server Error in 5ms (Views: 1.5ms | ActiveRecord: 0.0ms)

maxhungry avatar Oct 02 '18 05:10 maxhungry