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
chore: resolve sidekiq json-unsafe warning #1272
chore: resolve sidekiq json-unsafe warning #1272
Conversation
Hi @porbas, thanks for the reply. My concern at first is a hash could contain nested hashes (with symbolized keys), so we would need something like Rails's Personally I think the JSON roundtrip is the simplest approach here since
|
There is no such possibility. We're dealing with https://github.com/RailsEventStore/rails_event_store/blob/master/ruby_event_store/lib/ruby_event_store/record.rb#L54-L64 |
I didn't know about it. Then, I guess |
Sidekiq 6.4 has started to log warnings (sidekiq/sidekiq#5071) if the job arguments are not strictly JSON-safe i.e. serializing to JSON and deserializing from JSON yield consistent outputs. To what it means, we cannot use a hash with symbol keys since doing the JSON rountrip will change them all to string keys. This fix will transform the hash argument with symbol keys to string keys so Sidekiq won't complain it (and break it starting version 7.0).
23fc9c1
to
3e241af
Compare
Thank you. Merged. I've changed You can always run mutation tests by running |
Hi @porbas, I just noticed this change for the gem Meanwhile, I did:
However, in my app, I still see some events that still raise a unsafe serialization alert from sidekiq, but perhaps its app specific, and I need to check them closer. |
Hi @pedrocarmona, I've released v 0.1.1 of Feel free to create another PR/issue in case you found further issues. |
Sidekiq 6.4 has started to log warnings
(sidekiq/sidekiq#5071) if the job arguments are
not strictly JSON-safe i.e. serializing to JSON and deserializing from
JSON yield consistent outputs. To what it means, we cannot use a hash
with symbol keys since doing the JSON rountrip will change them all to
string keys.
This fix will transform the hash argument with symbol keys to string
keys so Sidekiq won't complain it (and break it starting version 7.0).
Before
After