fix: use PATCH instead of PUT when updating clientPreferences (Profile System V2)#698
Conversation
…ile System V2 PUT was overwriting the entire purchase-info entity with only clientPreferences data, wiping paymentData (saved cards) from the user profile. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖 Please select which version do you want to release:
And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.
|
|
Beep boop 🤖 I noticed you didn't make any changes at the
In order to keep track, I'll create an issue if you decide now is not a good time
|
wisneycardeal
left a comment
There was a problem hiding this comment.
That change was aligned during the #inc-5621.
This point is encapsulated in a method that maintains the same signature.
So LGTM.
|
Your PR has been merged! App is being published. 🚀 After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:
After that your app will be updated on all accounts. For more information on the deployment process check the docs. 📖 |
Problem
When a user updates their newsletter preferences (
updatePersonalPreferences),store-graphqlwas callingPUT /purchase-infosending only theclientPreferencespayload. Because PUT replaces the entire entity, thepaymentDatafield (saved cards) was being wiped from the user's profile.This was identified as the root cause of a production incident where transactions were being cancelled via the WorldpayVTEX connector: the
gatewayCallbackvalidation was failing because the saved card appeared to belong to a "loaded profile" (no login), since the card data had been removed from the real profile after the PUT.The Storage team blocked external write access to
purchase-infoas a mitigation, and this PR addresses the same issue at thestore-graphqllevel.Fix
Changed
this.put→this.patchinupdatePersonalPreferences(profileV2.ts:133).PATCHperforms a partial update, merging onlyclientPreferencesinto the existing document and leavingpaymentDataintact.No other calls to
purchase-infoin this codebase use PUT — the V1 client usesPOST /personalPreferences/(a different endpoint) and is not affected.