Skip to content
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

V1/carts/mine/billing-address returning %fieldName is a required field. #7299

Closed
alessandrozucca opened this issue Nov 3, 2016 · 24 comments
Closed
Assignees
Labels
Event: dmcdindia1 Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@alessandrozucca
Copy link

alessandrozucca commented Nov 3, 2016

Preconditions

  1. Magento EE 2.1.1
  2. PHP 7.0.12
  3. Mysql Ver 14.14 Distrib 5.6.33-79.0, for Linux (x86_64) using 6.2

Steps to reproduce

    1. Go to the checkout after adding something to the basket
    1. Send a request to the REST endpoint V1/carts/mine/billing-address using the payload below
{"cartId":"190488","address":{"countryId":"GB","regionId":"0","region":"","street":["54 Carnegie Court",""],"company":"","telephone":"0165 4569 8754","fax":"","postcode":"AB1C 2DF","city":"SomeCity","firstname":"Bob","lastname":"White","save_in_address_book":1,"saveInAddressBook":null}}

Note that this api endpoint is used by the module ebizmarts/sagepaysuite for the payment option SagePay

Actual result

{
  "message": "%fieldName is a required field.",
  "parameters": {
    "fieldName": "cartId"
  },
  "trace": "
  #0 magento/framework/Webapi/ServiceInputProcessor.php(131): Magento\\Framework\\Webapi\\ServiceInputProcessor->processInputError(Array)\n
  #1 magento/module-webapi/Controller/Rest/InputParamsResolver.php(101): Magento\\Framework\\Webapi\\ServiceInputProcessor->process('Magento\\\\Quote\\\\A...', 'assign', Array)\n
  #2 magento/module-webapi/Controller/Rest.php(299): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver->resolve()\n
  #3 magento/module-webapi/Controller/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n
  #4 magento/framework/Interception/Interceptor.php(146): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
  #5 /var/www/qa-mowdirect.webpipeline.net/shared/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(39): Magento\\Webapi\\Controller\\Rest\\Interceptor->___callPlugins('dispatch', Array, Array)\n
  #6 magento/framework/App/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n
  #7 magento/framework/App/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n
  #8 /var/www/qa-mowdirect.webpipeline.net/releases/20161102175610/pub/index.php(37): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n
  #9 {main}"
}

Note that cartId is in the payload but the parameter validation fails.

@thdoan
Copy link

thdoan commented May 3, 2017

@alessandrozucca may I know what the resolution was? We seem to be having a similar issue:

Request URL = V1/carts/mine/estimate-shipping-methods-by-address-id
Request Payload = {addressId: "60"}
Response =
{"message":"%fieldName is a required field.","parameters": {"fieldName":"cartId"}

@alessandrozucca
Copy link
Author

The issue wasn't resolved.

My current company, did send it to Magento via the "partners portal", the project I was working on then got blocked for other reasons and I didn't follow up with the issue.

If you are getting it too, then is definitely an issue that should be fixed.

@collymore
Copy link

collymore commented May 17, 2017

We're getting the same issue.
If logged in with a saved address then it fails with visible error message "cartId is a required field"

Steps to reproduce.

No other JS errors are shown on the checkout.

PHP 7.0.10
Current application mode: developer
Magento : 2.1.6

Quick update:
I've found it happens almost all the time on a second purchase, after a successful purchase and remaining logged in, when trying to make a second purchase it causes the issue. If I logout and back in I'm able to make a second purchase fine.

@MikeSheward
Copy link

MikeSheward commented May 17, 2017

I'm getting this error too, guest checkout is disabled and checking out as a registered user.
It's trying to goto: /rest/default/V1/carts/mine/estimate-shipping-methods-by-address-id
Req payload:
{addressId: "13"}

but that returns
"message": "%fieldName is a required field.", "parameters": { "fieldName": "cartId" }

Stacktrace
{ "message": "%fieldName is a required field.", "parameters": { "fieldName": "cartId" }, "trace": "#0 \/home\/magento\/public_html\/vendor\/magento\/framework\/Webapi\/ServiceInputProcessor.php(131): Magento\\Framework\\Webapi\\ServiceInputProcessor->processInputError(Array)\n#1 \/home\/magento\/public_html\/vendor\/magento\/module-webapi\/Controller\/Rest\/InputParamsResolver.php(101): Magento\\Framework\\Webapi\\ServiceInputProcessor->process('Magento\\\\Quote\\\\A...', 'estimateByAddre...', Array)\n#2 \/home\/magento\/public_html\/vendor\/magento\/module-webapi\/Controller\/Rest.php(299): Magento\\Webapi\\Controller\\Rest\\InputParamsResolver->resolve()\n#3 \/home\/magento\/public_html\/vendor\/magento\/module-webapi\/Controller\/Rest.php(216): Magento\\Webapi\\Controller\\Rest->processApiRequest()\n#4 \/home\/magento\/public_html\/var\/generation\/Magento\/Webapi\/Controller\/Rest\/Interceptor.php(37): Magento\\Webapi\\Controller\\Rest->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#5 \/home\/magento\/public_html\/vendor\/magento\/framework\/App\/Http.php(135): Magento\\Webapi\\Controller\\Rest\\Interceptor->dispatch(Object(Magento\\Framework\\App\\Request\\Http))\n#6 \/home\/magento\/public_html\/vendor\/magento\/framework\/App\/Bootstrap.php(258): Magento\\Framework\\App\\Http->launch()\n#7 \/home\/magento\/public_html\/pub\/index.php(53): Magento\\Framework\\App\\Bootstrap->run(Object(Magento\\Framework\\App\\Http))\n#8 {main}" }

This behaviour is intermittent too (deleting the item from the cart and readding sometimes also solves this)

Any ideas? Thanks

@MikeSheward
Copy link

Any updates on this?
Thanks

@jugal-kishor
Copy link

{"message":"%fieldName is a required field.","parameters":{"fieldName":"cartId"},"trace":"#0 /home
/daraway1/public_html/vendor/magento/framework/Webapi/ServiceInputProcessor.php(111): Magento
\Framework\Webapi\ServiceInputProcessor->processInputError(Array)\n#1 /home/daraway1/public_html
/vendor/magento/module-webapi/Controller/Rest.php(262): Magento\Framework\Webapi\ServiceInputProcessor-

process('Magento\\Checkou...', 'savePaymentInfo...', Array)\n#2 /home/daraway1/public_html/vendor
/magento/module-webapi/Controller/Rest.php(160): Magento\Webapi\Controller\Rest->processApiRequest
()\n#3 /home/daraway1/public_html/var/generation/Magento/Webapi/Controller/Rest/Interceptor
.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http)
)\n#4 /home/daraway1/public_html/vendor/magento/framework/App/Http.php(115): Magento\Webapi
\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /home
/daraway1/public_html/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App
\Http->launch()\n#6 /home/daraway1/public_html/index.php(45): Magento\Framework\App\Bootstrap-
run(Object(Magento\Framework\App\Http))\n#7 {main}"}

@jugal-kishor
Copy link

i got this error when i place order on frontend also i checked sales order in admin order showing is in peding. mean order showing in admin but not working on frontend

@panneerselvam-vit
Copy link

Hi

i fixed this issue. Below is the fix for this issue.

  1. pass cartId in the below js after line no.
    file : Magento_Checkout\web\js\model\shipping-rate-processor\customer-address.js

                storage.post(
                    resourceUrlManager.getUrlForEstimationShippingMethodsByAddressId(quote),
                    JSON.stringify({
                        addressId: address.customerAddressId,
    	    cartId: quote.getQuoteId()
                    }),
                    false
                )
    
  2. Prevent cartId param removal by adding a plugin for the below method

File : \Magento\Webapi\Controller\Rest\ParamsOverrider

plugin

public function aroundoverride(\Magento\Webapi\Controller\Rest\ParamsOverrider $ParamsOverrider,\Closure $proceed,array $inputData, array $parameters)
{
	if(isset($inputData['cartId'])){$cartid = $inputData['cartId'];}		
	$result = $proceed($inputData,$parameters);
	if(isset($cartid)){$result['cartId'] = $cartid;}
	return $result;		
}

@ebaschiera
Copy link

Hi @panneerselvam-vit ,
thanks for your fix! I found a little problem at checkout when adding a coupon code as a registered user. The coupon cannot be added due to the following error: Invalid type for value: "mine". Expected Type: "int".

So I modified the plugin like this:

public function aroundoverride(\Magento\Webapi\Controller\Rest\ParamsOverrider $ParamsOverrider, \Closure $proceed, array $inputData, array $parameters) {
    if (isset($inputData['cartId']) && (!isset($inputData['couponCode']) || !isset($inputData['coupon_code']))) {
            $cartid = $inputData['cartId'];
        }
        $result = $proceed($inputData, $parameters);
        if (isset($cartid)) {
            $result['cartId'] = $cartid;
        }
        return $result;
    }

Best regards.

@idziakjakub
Copy link
Contributor

Hello,

I had the same issue on stage server, it appeared unexpectedly when client was testing orders.
This project was tested on docker, vagrant and latest server and there was newer a problem with checkout page.
I started to check @panneerselvam-vit fixes and I found that some folders has permissions only for user and group "root" (var/generation, var/di) and when I fixed permissions problem has solved.

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Sep 11, 2017
@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Nov 27, 2017
@magento-engcom-team
Copy link
Contributor

@alessandrozucca, thank you for your report.
We've created internal ticket(s) MAGETWO-84524 to track progress on the issue.

@magento-engcom-team magento-engcom-team added 2.1.x Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Nov 27, 2017
@ghost
Copy link

ghost commented Feb 13, 2019

Similar or identical github issues for this same error:

#9744

#7299

#1443

#5847

shipperhq/module-shipper#27

#6522

All related, tried every solution on all pages and still have the issue, including @sydekumf solution here:
#9744 (comment)
this solution #7299 (comment)
this solution #7299 (comment)
and checked if this solution would apply but it didn't:
#5847 (comment)

Issue MAGETWO-84524 is tracking it to some degree and still isn't fixed in Magento 2.3

How is this the most popular ecommerce store in the US if it doesn't even have a functioning checkout. This happens for me using authnet directpost regardless of what I do, guest checkout, or new, using stored address, or not. Only the error message will change at times, but it's always one of the error messages given in the links above.

Issue is as described, there is a quote_id in the quote table but it is not active. If I switch it manually to be active then it has duplicate foreign key when trying to replace the order. With active set to 0, get the cartId error.

The only solution anyone seems to say works 100% is buying a 3rd part module to do authorize.net payments which seems absurd, as paypal also doesn't work, citing invoice id errors.

@ghost ghost mentioned this issue Feb 13, 2019
@gakonhd
Copy link

gakonhd commented May 2, 2019

Has anyone found the solution with this issue yet? I am using Magento 2..2.8 and I still have this problem

@GovindaSharma GovindaSharma self-assigned this May 4, 2019
@m2-assistant
Copy link

m2-assistant bot commented May 4, 2019

Hi @GovindaSharma. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

@GovindaSharma
Copy link
Contributor

#dmcdindia1

@GovindaSharma
Copy link
Contributor

i am working on this

@gakonhd
Copy link

gakonhd commented May 6, 2019

Hi @GovindaSharma. Thank you for working on this issue.
Looks like this issue is already verified and confirmed. But if you want to validate it one more time, please, go though the following instruction:

  • 1. Add/Edit Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 2. Verify that the issue is reproducible on 2.3-develop branchDetails- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure. - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 3. Verify that the issue is reproducible on 2.2-develop branch. Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure. - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 4. If the issue is not relevant or is not reproducible any more, feel free to close it.

Thank you for having people working on this. I am looking forward to the update of this version. Thank you again.

@magento-engcom-team
Copy link
Contributor

Hi @gakonhd. Thank you for your request. I'm working on Magento 2.3-develop instance` to deploy test instance for you

@gakonhd
Copy link

gakonhd commented May 6, 2019

Hi @gakonhd. Thank you for your request. I'm working on Magento 2.3-develop instance` to deploy test instance for you

Hi @magento-engcom-team , thank you for the update. I wonder if the fix will be applied to 2.2.8 version as well ?

@pkavanaghjr
Copy link

@gakonhd @magento-engcom-team

I am also looking for a solution to be released for v2.2.8, is that currently in development as well?

@ladle3000
Copy link

Also urgently needing help with this. What fixes it?

@ghost
Copy link

ghost commented Jul 31, 2019

This is what "fixed" it for me, just like a lot else broken in M2, if you want it to actually work you have to purchase a module, going m2 was a giant mistake. https://store.paradoxlabs.com/magento2-authorize-net-cim-payment-module.html

@ghost ghost unassigned GovindaSharma Aug 21, 2019
@engcom-Charlie
Copy link
Contributor

Hello @alessandrozucca

I am not able to reproduce this issue on a fresh Magento 2.4-develop

Testing scenario:

  1. Go to the checkout after adding something to the basket
  2. Send a request to the REST endpoint V1/carts/mine/billing-address using the payload below
    {"cartId":"6","address":{"countryId":"GB","regionId":"0","region":"","street":["54 Carnegie Court",""],"company":"","telephone":"0165 4569 8754","fax":"","postcode":"AB1C 2DF","city":"SomeCity","firstname":"Bob","lastname":"White","save_in_address_book":1,"saveInAddressBook":null}}

Result:
200 OK success
image

Could you add detailed steps to reproduce this issue in your case?

@engcom-Charlie engcom-Charlie self-assigned this Dec 24, 2019
@engcom-Charlie engcom-Charlie added Progress: needs update and removed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Dec 24, 2019
@magento magento deleted a comment from m2-assistant bot Dec 24, 2019
@engcom-Charlie
Copy link
Contributor

We are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Event: dmcdindia1 Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update Reproduced on 2.1.x The issue has been reproduced on latest 2.1 release Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests