I was debugging why the data we had in one system did not match the data we had in DatoCMS for a particular record in our âOfferâ model. I determined that our system had the correct information (expiration_datetime) and had the system update the record in Dato using the content management API with the correct data and then publish those changes. It did correctly update the record in the model, but two publish webhook events fired:
The first one had the old expiration_datetime field value of â2024-12-31T23:59:00-05:00â. Here is the meta data for that webhook:
The next publish webhook had the correct value for the expiration_datetime field of â2024-12-30T08:58:02-05:00â
Here is the meta data for that webhook request:
Why would we receive two of these requests? And why would one contain the wrong data? Iâve excluded the full webhook payload because it can be quite large. But, I can provide it if needed.
With webhook calls 137271943 and 137271949, it looks like there were actually some changes? Can you try running the two of them through a diff and see if those are intentional?
For example, the system_facets field was null in 137271943 and became an array of record links in 137271949. A few other fields (legacy_id, tracking, and content also changed).
Is this something your script might be doing? If itâs changing relationships, is it possible that itâs causing some cascading changes?
I donât want to dive into your private schema here in public, but if you canât figure it out based on a diff, could you please email us at support@datocms.com with some details about the use case here (like how your script interacts with this model and its related fields).
I wanted to post here for anyone that may come across this discussion in the community.
After some private discussions with roger, we settled on two changes to help either mitigate this issue or work-around the problem:
We were using the âselectively publishâ approach to publishing content via the CMA API (despite the fact that we donât use the locale features of DatoCMS). We switched to using the âpublish entire recordâ method. Example here.
We added code on our end to ignore webhook requests sent to us from DatoCMS that had an âevent_typeâ of âpublishâ and an entity.meta.status value of âupdatedâ. These webhook payloads seem to suggest that DatoCMS thinks there is a locale for a record that is still in the âupdatedâ status and it seems safe to ignore them. We still were receiving a proper webhook payload for that event around the same time and could process that one.