-
-
Notifications
You must be signed in to change notification settings - Fork 170
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
Product data changes not geting properly synced to Sanity if there's another product with same slug #116
Comments
Hey there @ansmlc by default Sanity checks for uniqueness on This is why it's not updating anything in Sanity when the sync function occurs. You can actually see the error message after the sync starts in your first screenshot: You'll need to either delete the previous documents (and remove all references to those elsewhere first), or you can try overriding the default validation for the product slug fields in your schema to allow it to create product documents with the same slug values. Let me know if that helps! 🤘 |
is there any way to check the localhost sanity error log? mine is not syncing |
@raqibnur please open a separate issue with more details about what you are experiencing, instead of commenting on other people's issues that are still open 🤘 |
@ndimatteo This has been resolved by rolling back to an older dataset backup and avoiding having same-slug documents. |
In scenario where there's two products with an identical slug field present in Sanity Studio, changing product data in Shopify doesn't update (any of) the auto-synced product data in Sanity. This seems strange because the update API takes into consideration product's id, which is of course different. At the same time, the functions log in Vercel shows successfully sync message every time.
If there's a new brand new product added (that doesn't have a duplicate) sync works as expected, which suggests the issue is specifically related to there being a duplicate slug field:
The yellow-marked part is a console-log is from
product-update.js
, checking the "URL Handle" Shopify field :The
![image](https://user-images.githubusercontent.com/50321640/208754246-11079d19-ab4c-460f-b66c-8ff17d910184.png)
handle
that's printed is in fact the correct, newly edited URL Handle from Shopify. However, it doesn't get reflected in Sanity:I than tried making some changes the API to force a change for the slug field, in :
That didn't work so I tried to unset the field:
which didn't work either.
As to why there are products with duplicate slug values, it's a result of switching to different Shopify store which had cloned all product data from previous store, so now there's duplicate products with duplicate slugs, neither of which can be deleted, and the new products can't be published either because of the duplicate slug validation error.
The text was updated successfully, but these errors were encountered: