How to debug `Job arguments to Rollbar::Delay::Sidekiq do not serialize to JSON safely` warning from Sidekiq?

240 Views Asked by At

I have the following log from my ruby on rails app.

- NoMethodError (undefined method `encode` for nil:NilClass
-       redirect_to "/post_message#token=#{@secret.encode(token)}"
-                                                 ^^^^^^^):
- app/controllers/canvas_test_controller.rb:126:in `redirect_token`
- I, [2023-08-22T10:21:40.643432 #25]  INFO -- : [3cc2fde2-4da9-451b-973e-15c8fe93d91d] [Rollbar] Scheduling item
- pid=25 tid=3a1x WARN: Job arguments to Rollbar::Delay::Sidekiq do not serialize to JSON safely. This will raise an error in
- Sidekiq 7.0. See https://github.com/mperham/sidekiq/wiki/Best-Practices or raise an error today
- by calling `Sidekiq.strict_args!` during Sidekiq initialization.

I intentionally raised this error to test rollbar but why am i getting a Sidekiq warning: Job arguments to Rollbar::Delay::Sidekiq do not serialize to JSON safely.

I applied Sidekiq's best practices to my code but this error seems to be coming from Rollbar::Delay::Sidekiq.

I am using the followig gems:

rollbar (3.4.0)
sidekiq (6.5.6)

I tried updating both sidekiq and rollbar to the latest version but still same warning persist. How do i debug this?

1

There are 1 best solutions below

0
adhu On

Thank you @cschroed. I looked into rollbar's documentation https://docs.rollbar.com/docs/sidekiq-integration and adding config.async_json_payload = true to rollbar's config solved the issue.