This morning my app started to crash (Error while trying to deserialize arguments
) because of some Shopify jobs that couldn’t find a model (products_update_job
).
After further investigation, I found that the code I’ve written in those jobs didn’t even try to search for a model, but merely deleted some Memcached tags.
I’ve been using the shopify_app
gem to set up the webhooks and process them.
2
Answers
After a lot of digging and a bit of luck, I noticed that the webhooks response from Shopify contained a new field
admin_graphql_api_id: gid://shopify/Product/817915723823
. Then I started to do some more digging and learning about Global ID to find that "Support is automatically included in Active Record."So what happened was that Shopify started, overnight, to send the
admin_graphql_api_id
field that automatically triggered the model search, messing with my app.The fix was to add an initializer that bypasses the model search, doing nothing.
I could use this feature to automatically find models but at times the app receives webhooks with products that aren't there anymore.
config/initializers/global_id.rb
Update
One quick fix is to filter out that param
I had nearly the identical problem yesterday from 10 am EST to ~6 pm. My app receives order payloads via webhook and queues them for processing using delayed_jobs. The error I got:
E, [2018-06-18T22:25:43.927114 #51] ERROR — : 2018-06-18T22:25:43+0000: [Worker(host:e069195b1b97 pid:51)] Job ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper (id=15571) (queue=webhook) FAILED (4 prior attempts) with ActiveJob::DeserializationError: Error while trying to deserialize arguments: uninitialized constant Order
I believe this is caused by this attribute, that apparently is no longer being sent:
admin_graphql_api_id: gid://shopify/Order/516…….
I’m going to chnage my app to write the payloads off to a new table, and only serialize to delayed_jobs the ID of the payload record.