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

Wrong number of arguments error when running a query #183

Open
itsameandrea opened this issue Oct 20, 2024 · 4 comments
Open

Wrong number of arguments error when running a query #183

itsameandrea opened this issue Oct 20, 2024 · 4 comments

Comments

@itsameandrea
Copy link

Hey there!

Just wanted to raise a possible bug I came across as I was testing things in my rails app.

For context, I'm using:

  • Motor Admin → 0.4.31
  • Rails 8 rc1 (although I tried also with 7.2)

When I create a query such as

SELECT *
FROM ahoy_events;

I get this

image

These are the logs

#<ArgumentError: wrong number of arguments (given 2, expected 3)>
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0.rc1/lib/active_record/sanitization.rb:203:in `replace_bind_variables'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/lib/motor/queries/run_query.rb:225:in `normalize_statement_for_sql'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/lib/motor/queries/run_query.rb:73:in `execute_query'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/lib/motor/queries/run_query.rb:38:in `call!'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/lib/motor/queries/run_query.rb:48:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/app/controllers/motor/run_queries_controller.rb:25:in `render_result'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/motor-admin-0.4.31/app/controllers/motor/run_queries_controller.rb:13:in `show'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/abstract_controller/base.rb:226:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/rendering.rb:193:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/abstract_controller/callbacks.rb:261:in `block in process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:120:in `block in run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.11/lib/turbo-rails.rb:24:in `with_request_id'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/turbo-rails-2.0.11/app/controllers/concerns/turbo/request_id_tracking.rb:10:in `turbo_tracking_request_id'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/audited-5.7.0/lib/audited/sweeper.rb:16:in `around'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ahoy_matey-5.2.1/lib/ahoy/controller.rb:50:in `set_ahoy_request_store'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:129:in `block in run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:140:in `run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/abstract_controller/callbacks.rb:260:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/rescue.rb:27:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/instrumentation.rb:76:in `block in process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `block in instrument'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/notifications/instrumenter.rb:58:in `instrument'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/notifications.rb:210:in `instrument'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/instrumentation.rb:75:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal/params_wrapper.rb:259:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0.rc1/lib/active_record/railties/controller_runtime.rb:39:in `process_action'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/abstract_controller/base.rb:163:in `process'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal.rb:252:in `dispatch'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_controller/metal.rb:335:in `dispatch'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/route_set.rb:50:in `serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:53:in `block in serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:133:in `block in find_routes'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:126:in `each'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:126:in `find_routes'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:34:in `serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/route_set.rb:908:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/engine/lazy_route_set.rb:68:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/engine.rb:535:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/railtie.rb:226:in `public_send'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/railtie.rb:226:in `method_missing'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/mapper.rb:33:in `block in <class:Constraints>'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/mapper.rb:62:in `serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:53:in `block in serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:133:in `block in find_routes'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:126:in `each'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:126:in `find_routes'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/journey/router.rb:34:in `serve'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/routing/route_set.rb:908:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/engine/lazy_route_set.rb:68:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/tempfile_reaper.rb:20:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/etag.rb:29:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/conditional_get.rb:31:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/head.rb:15:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/http/permissions_policy.rb:38:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/http/content_security_policy.rb:35:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-session-2.0.0/lib/rack/session/abstract/id.rb:272:in `context'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-session-2.0.0/lib/rack/session/abstract/id.rb:266:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/cookies.rb:706:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activerecord-8.0.0.rc1/lib/active_record/migration.rb:671:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/callbacks.rb:31:in `block in call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/activesupport-8.0.0.rc1/lib/active_support/callbacks.rb:100:in `run_callbacks'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/callbacks.rb:30:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/executor.rb:16:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/debug_exceptions.rb:31:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/web-console-4.2.1/lib/web_console/middleware.rb:132:in `call_app'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/web-console-4.2.1/lib/web_console/middleware.rb:28:in `block in call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/web-console-4.2.1/lib/web_console/middleware.rb:17:in `catch'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/web-console-4.2.1/lib/web_console/middleware.rb:17:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/show_exceptions.rb:32:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/rack/logger.rb:41:in `call_app'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/rack/logger.rb:29:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/ahoy_matey-5.2.1/lib/ahoy/engine.rb:22:in `call_with_quiet_ahoy'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/remote_ip.rb:96:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/request_id.rb:34:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/method_override.rb:28:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/runtime.rb:24:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/server_timing.rb:61:in `block in call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/server_timing.rb:26:in `collect_events'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/server_timing.rb:60:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/executor.rb:16:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/static.rb:27:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/rack-3.1.8/lib/rack/sendfile.rb:114:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/actionpack-8.0.0.rc1/lib/action_dispatch/middleware/host_authorization.rb:143:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/railties-8.0.0.rc1/lib/rails/engine.rb:535:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/configuration.rb:272:in `call'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/request.rb:100:in `block in handle_request'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/thread_pool.rb:378:in `with_force_shutdown'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/request.rb:99:in `handle_request'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/server.rb:464:in `process_client'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/server.rb:245:in `block in run'
07:10:21 web.1  | /Users/ilrock/.rbenv/versions/3.3.0/lib/ruby/gems/3.3.0/gems/puma-6.4.3/lib/puma/thread_pool.rb:155:in `block in spawn_thread'
07:10:21 web.1  | Completed 500 Internal Server Error in 2ms (Views: 0.1ms | ActiveRecord: 0.1ms (1 query, 0 cached) | GC: 0.0ms)
@nukturnal
Copy link

I'm getting the same error as well

@itsameandrea
Copy link
Author

@nukturnal were you able to find any workarounds?

@nukturnal
Copy link

nukturnal commented Oct 23, 2024

Hey @itsameandrea I actually just fixed it like 2mins ago. Looks like a Rails 7.2 issue after my gems update yesterday, I moved back to the latest 7.1 version, and it got everything working

@itsameandrea
Copy link
Author

itsameandrea commented Oct 25, 2024

Right, fair enough. I guess I'll wait until it gets fixed for rails 7.2+. Maybe I'll see if I can submit a PR for it.

Thanks!

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