magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

Magento 2 REST API / UPDATE CUSTOMER (The %fieldName value is invalid. Set the correct value and try again. / fieldName": "default_billing")

Open dariovranjkovic opened this issue 1 year ago • 13 comments

Preconditions and environment

  • Magetno 2.4.7
  • PHP 8.2

Steps to reproduce

  1. Send request for update customer to rest API URL: https://shop.com/rest/V1/customers/3420 Body: { "customer": { "firstname": "Company Name AB", "lastname": "Location", "addresses": [ { "defaultShipping": "false", "defaultBilling": "false", "firstname": "Company Name AB", "lastname": "-", "postcode": "XXXXX", "street": [ "Street Address" ], "city": "CITY", "telephone": "+XX XXX XXX XXX", "countryId": "XX" }, { "defaultShipping": "true", "defaultBilling": "true", "firstname": "Company Name AB", "lastname": "-", "postcode": "XXXXX", "street": [ "Street Address" ], "city": "CITY", "telephone": "+XX XXX XXX XXX", "countryId": "XX" } ] } }

or

{ "customer": { "firstname": "Company Name AB", "lastname": "Location", "addresses": [ { "default_shipping": "false", "default_billing": "false", "firstname": "Company Name AB", "lastname": "-", "postcode": "XXXXX", "street": [ "Street Address" ], "city": "CITY", "telephone": "+XX XXX XXX XXX", "countryId": "XX" }, { "default_shipping": "true", "default_billing": "true", "firstname": "Company Name AB", "lastname": "-", "postcode": "XXXXX", "street": [ "Street Address" ], "city": "CITY", "telephone": "+XX XXX XXX XXX", "countryId": "XX" } ] } }

Expected result

Updated customer

Actual result

{ "message": "The %fieldName value is invalid. Set the correct value and try again.", "parameters": { "fieldName": "default_billing" } }

Additional information

It was working before upgrade on version 2.4.3 but now is not working on version 2.4.7

Release note

No response

Triage and priority

  • [X] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • [ ] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

dariovranjkovic avatar Jun 26 '24 10:06 dariovranjkovic

Hi @dariovranjkovic. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel. :warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting. :clock10: You can find the schedule on the Magento Community Calendar page. :telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

m2-assistant[bot] avatar Jun 26 '24 10:06 m2-assistant[bot]

Hi @engcom-Dash. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

m2-assistant[bot] avatar Jun 26 '24 11:06 m2-assistant[bot]

We are having the same issue on 2.4.6-p5, we figured we were pushing data incorrectly, but it may be a bug with Magento itself?

frostitution avatar Jun 27 '24 19:06 frostitution

Hi @engcom-Delta. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • [ ] 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • [ ] 5. Add label Issue: Confirmed once verification is complete.
  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Jun 28 '24 10:06 m2-assistant[bot]

Hi @dariovranjkovic ,

Verified the issue on 2.4.7 and it is reproducible.

Steps to reproduce:-

1.Send request for update customer to rest API

Screenshot 2024-06-28 at 9 00 43 PM

engcom-Delta avatar Jun 28 '24 15:06 engcom-Delta

Hi @dariovranjkovic ,

Verified this issue on 2.4.3 and 2.4.7 and it is reproducible on 2.4.7.

Hence confirming this issue.

Steps to reproduce:-

1.Send request for update customer to rest API

2.4.3 ,working fine

Screenshot 2024-07-01 at 7 24 04 PM

2.4.7, error

Screenshot 2024-07-01 at 7 26 48 PM

engcom-Delta avatar Jul 01 '24 14:07 engcom-Delta

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12318 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Jul 01 '24 14:07 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Jul 01 '24 14:07 m2-assistant[bot]

:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-12318

github-jira-sync-bot avatar Jul 01 '24 14:07 github-jira-sync-bot

@magento I am working on this

shmVan avatar Jul 12 '24 09:07 shmVan

This issue was introduced in 0b600deeef7853dcc3243725e77dc6e412bc8b65. It breaks the backwards compatibility of the customer api.

Following Version is affected too: 2.4.5-p9

DanieliMi avatar Aug 19 '24 12:08 DanieliMi

Worth mentioning, that this B/C break seems to have slipped into the security-upgrade from 2.4.5-p8 -> 2.4.5-p9 with the commit https://github.com/magento/magento2/commit/6fedf5c513623ecc8a1a580501a49a1331e68568

The question is, if this was by mistake and if we can revert it after the security update - or if this patch actually fixes a security problem.

amenk avatar Aug 19 '24 13:08 amenk

@shmVan Is there already a patch available for this issue? We're running into the same problem.

HeRovaZy avatar Sep 30 '24 08:09 HeRovaZy

We have a related issue, where it returns:

{"message":"The %fieldName value is invalid. Set the correct value and try again.","parameters":{"fieldName":"default_shipping"}}

This is when we update the customer with 1 address as both default shipping and billing, and leave out the current shipping address.

barryvdh avatar Oct 28 '24 09:10 barryvdh

Having same issue here. Trying save customer and getting "The default_billing value is invalid. Set the correct value and try again.". I have 1 address assigned as billing and shipping After debugging i see that function \Magento\Customer\Model\ResourceModel\CustomerRepository::validateDefaultAddress throwing that exception because $customer->getAddresses() return current address without id so NULL !== ID. Screenshot 2024-10-29 at 13 05 00

vmartynovexo avatar Oct 29 '24 12:10 vmartynovexo

This commit is the one which fixes the issue for me https://github.com/magento/magento2/commit/f1b98a304b27153cec2dae2c02bc422e78d8609b

raghuiamsingh avatar Dec 19 '24 11:12 raghuiamsingh

@raghuiamsingh Thanks for your Contribution!!.

Issue has been fixed here Related commits: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-13512&type=commits

Thanks

engcom-Bravo avatar Apr 03 '25 08:04 engcom-Bravo