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

Sidekiq Web: Unhandled can't convert String into an exact number (TypeError) #6284

Open
kapso opened this issue May 9, 2024 · 3 comments
Open

Comments

@kapso
Copy link

kapso commented May 9, 2024

I am seeing this too on

  • Rails 7.1.3.2
  • Sidekiq v7.2.4 / Pro v7.2.0
  • Ruby 3.3.1
  • Redis 6.2.8

This happens when I try to click on a retry - eg: sidekiq/retries/1714694009.406673-114bc6736276e28b7fcc90fd on sidekiq/retries

4124baeaa770f3caac681" for 12.10.42.10 at 2024-05-02 23:19:26 +0000
2024-05-02T23:19:26.247920+00:00 app[web.1]: F, [2024-05-02T23:19:26.247823 #80] FATAL -- : [0d57b5c3-ec06-4369-95c5-61120e7991a8]
2024-05-02T23:19:26.247922+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] TypeError (can't convert String into an exact number):
2024-05-02T23:19:26.247923+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8]
2024-05-02T23:19:26.247924+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] <internal:timev>:286:in `at'
2024-05-02T23:19:26.247926+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/core_ext/time/calculations.rb:56:in `at_with_coercion'
2024-05-02T23:19:26.247926+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/api.rb:425:in `enqueued_at'
2024-05-02T23:19:26.247927+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:103:in `_erb__job_info'
2024-05-02T23:19:26.247927+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:94:in `_erb'
2024-05-02T23:19:26.247928+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:60:in `erb'
2024-05-02T23:19:26.247928+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:54:in `_erb_retry'
2024-05-02T23:19:26.247929+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:94:in `_erb'
2024-05-02T23:19:26.247929+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/action.rb:63:in `erb'
2024-05-02T23:19:26.247929+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/application.rb:223:in `block in <class:WebApplication>'
2024-05-02T23:19:26.247930+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/application.rb:416:in `instance_exec'
2024-05-02T23:19:26.247930+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/application.rb:416:in `block in call'
2024-05-02T23:19:26.247930+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/application.rb:414:in `catch'
2024-05-02T23:19:26.247931+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/application.rb:414:in `call'
2024-05-02T23:19:26.247931+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/csrf_protection.rb:51:in `admit'
2024-05-02T23:19:26.247931+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web/csrf_protection.rb:40:in `call'
2024-05-02T23:19:26.247931+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/auth/basic.rb:28:in `call'
2024-05-02T23:19:26.247932+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/static.rb:161:in `call'
2024-05-02T23:19:26.247932+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/static.rb:161:in `call'
2024-05-02T23:19:26.247932+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/builder.rb:244:in `call'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web.rb:117:in `call'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sidekiq (7.2.4) lib/sidekiq/web.rb:122:in `call'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/routing/mapper.rb:22:in `block in <class:Constraints>'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/routing/mapper.rb:51:in `serve'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/journey/router.rb:51:in `block in serve'
2024-05-02T23:19:26.247933+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/journey/router.rb:131:in `block in find_routes'
2024-05-02T23:19:26.247934+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/journey/router.rb:124:in `each'
2024-05-02T23:19:26.247934+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/journey/router.rb:124:in `find_routes'
2024-05-02T23:19:26.247934+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/journey/router.rb:32:in `serve'
2024-05-02T23:19:26.247934+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/routing/route_set.rb:882:in `call'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] skylight (6.0.4) lib/skylight/probes/action_dispatch/routing/route_set.rb:10:in `block in call'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/notifications.rb:206:in `block in instrument'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/notifications/instrumenter.rb:58:in `instrument'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-rails (5.17.3) lib/sentry/rails/tracing.rb:54:in `instrument'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/notifications.rb:206:in `instrument'
2024-05-02T23:19:26.247935+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] skylight (6.0.4) lib/skylight/probes/action_dispatch/routing/route_set.rb:10:in `call'
2024-05-02T23:19:26.247945+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] omniauth (2.1.2) lib/omniauth/strategy.rb:202:in `call!'
2024-05-02T23:19:26.247945+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] omniauth (2.1.2) lib/omniauth/strategy.rb:169:in `call'
2024-05-02T23:19:26.247945+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] omniauth (2.1.2) lib/omniauth/builder.rb:44:in `call'
2024-05-02T23:19:26.247946+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack-attack (6.7.0) lib/rack/attack.rb:127:in `call'
2024-05-02T23:19:26.247946+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack-brotli (1.2.0) lib/rack/brotli/deflater.rb:34:in `call'
2024-05-02T23:19:26.247946+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/deflater.rb:44:in `call'
2024-05-02T23:19:26.247946+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/tempfile_reaper.rb:15:in `call'
2024-05-02T23:19:26.247947+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/etag.rb:27:in `call'
2024-05-02T23:19:26.247947+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/conditional_get.rb:27:in `call'
2024-05-02T23:19:26.247947+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/head.rb:12:in `call'
2024-05-02T23:19:26.247948+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/http/permissions_policy.rb:36:in `call'
2024-05-02T23:19:26.247948+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/http/content_security_policy.rb:33:in `call'
2024-05-02T23:19:26.247948+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/session/abstract/id.rb:266:in `context'
2024-05-02T23:19:26.247949+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/session/abstract/id.rb:260:in `call'
2024-05-02T23:19:26.247950+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/cookies.rb:689:in `call'
2024-05-02T23:19:26.247951+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
2024-05-02T23:19:26.247951+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/callbacks.rb:101:in `run_callbacks'
2024-05-02T23:19:26.247951+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/callbacks.rb:28:in `call'
2024-05-02T23:19:26.247951+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-rails (5.17.3) lib/sentry/rails/rescued_exception_interceptor.rb:12:in `call'
2024-05-02T23:19:26.247951+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/debug_exceptions.rb:29:in `call'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry/rack/capture_exceptions.rb:29:in `block (2 levels) in call'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry/hub.rb:251:in `with_session_tracking'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry-ruby.rb:403:in `with_session_tracking'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry/rack/capture_exceptions.rb:20:in `block in call'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry/hub.rb:59:in `with_scope'
2024-05-02T23:19:26.247952+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry-ruby.rb:383:in `with_scope'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] sentry-ruby (5.17.3) lib/sentry/rack/capture_exceptions.rb:19:in `call'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/show_exceptions.rb:31:in `call'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] railties (7.1.3.2) lib/rails/rack/logger.rb:37:in `call_app'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] railties (7.1.3.2) lib/rails/rack/logger.rb:24:in `block in call'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/tagged_logging.rb:135:in `block in tagged'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/tagged_logging.rb:39:in `tagged'
2024-05-02T23:19:26.247953+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/tagged_logging.rb:135:in `tagged'
2024-05-02T23:19:26.247954+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/broadcast_logger.rb:240:in `method_missing'
2024-05-02T23:19:26.247954+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] railties (7.1.3.2) lib/rails/rack/logger.rb:24:in `call'
2024-05-02T23:19:26.247954+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/remote_ip.rb:92:in `call'
2024-05-02T23:19:26.247954+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] request_store (1.7.0) lib/request_store/middleware.rb:19:in `call'
2024-05-02T23:19:26.247958+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/request_id.rb:28:in `call'
2024-05-02T23:19:26.247958+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] skylight (6.0.4) lib/skylight/probes/action_dispatch/request_id.rb:8:in `call'
2024-05-02T23:19:26.247958+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/method_override.rb:24:in `call'
2024-05-02T23:19:26.247958+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/runtime.rb:22:in `call'
2024-05-02T23:19:26.247959+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] activesupport (7.1.3.2) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
2024-05-02T23:19:26.247959+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/executor.rb:14:in `call'
2024-05-02T23:19:26.247959+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/static.rb:25:in `call'
2024-05-02T23:19:26.247959+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack (2.2.9) lib/rack/sendfile.rb:110:in `call'
2024-05-02T23:19:26.247959+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] actionpack (7.1.3.2) lib/action_dispatch/middleware/ssl.rb:79:in `call'
2024-05-02T23:19:26.247960+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] rack-heartbeat (1.1.0) lib/rack/heartbeat.rb:45:in `call'
2024-05-02T23:19:26.247960+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] railties (7.1.3.2) lib/rails/engine.rb:536:in `call'
2024-05-02T23:19:26.247960+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/configuration.rb:272:in `call'
2024-05-02T23:19:26.247960+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/request.rb:100:in `block in handle_request'
2024-05-02T23:19:26.247961+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/thread_pool.rb:378:in `with_force_shutdown'
2024-05-02T23:19:26.247961+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/request.rb:99:in `handle_request'
2024-05-02T23:19:26.247961+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/server.rb:464:in `process_client'
2024-05-02T23:19:26.247961+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/server.rb:245:in `block in run'
2024-05-02T23:19:26.247962+00:00 app[web.1]: [0d57b5c3-ec06-4369-95c5-61120e7991a8] puma (6.4.2) lib/puma/thread_pool.rb:155:in `block in spawn_thread'

Maybe related to following issues

@kapso kapso changed the title Unhandled can't convert String into an exact number (TypeError) Sidekiq Web: Unhandled can't convert String into an exact number (TypeError) May 9, 2024
@mperham
Copy link
Collaborator

mperham commented May 11, 2024

Your job payload has enqueued_at as a String rather than a Float as Sidekiq expects it. How did you created the job?

@kapso
Copy link
Author

kapso commented May 17, 2024

@mperham here's how

SlackPostMessageWorker.perform_async({ channel: '#server-events', blocks: }.deep_stringify_keys)

Sidekiq config

# Web Dashboard
require 'sidekiq/pro/web'
require 'sidekiq-scheduler'
require 'sidekiq-scheduler/web'

Sidekiq.configure_client do |config|
  config.redis = { url: Settings.redis.url, ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
  config.logger.level = Rails.env.development? ? Logger::INFO : Logger::WARN

  # Sidekiq Pro options
  Sidekiq::Client.reliable_push! unless Rails.env.test?

  # Sidekiq Unique Jobs options
  config.client_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Client
  end
end

Sidekiq.configure_server do |config|
  config.redis = { url: Settings.redis.url, ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE } }
  config.logger.level = Rails.env.development? ? Logger::INFO : Logger::WARN

  # Default is 5
  config.average_scheduled_poll_interval = 2

  config.on(:startup) do
    Sidekiq.schedule = YAML.safe_load(ERB.new(Rails.root.join('config/schedule.yml').read).result)
    SidekiqScheduler::Scheduler.instance.reload_schedule!
  end

  # Sidekiq Pro options
  Sidekiq::Client.reliable_push! unless Rails.env.test?
  config.super_fetch!
  config.reliable_scheduler!

  # Sidekiq Unique Jobs options
  config.client_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Client
  end

  config.server_middleware do |chain|
    chain.add SidekiqUniqueJobs::Middleware::Server
  end

  SidekiqUniqueJobs::Server.configure(config)
  SidekiqUniqueJobs.config.lock_info = true
end

if Rails.env.staging? || Rails.env.production?
  Sidekiq::Web.use Rack::Auth::Basic do |username, password|
    username == Settings.sidekiq.admin.username && password == Settings.sidekiq.admin.password
  end
end

@mperham
Copy link
Collaborator

mperham commented May 17, 2024

I think you'll need to show us the exact job payload. Can you get it out of Redis with redis-cli?

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