I have upgraded the Magento version to 2.3.7. After that, I have a strange issue on the checkout page that when it calls ajax function the URL is been wrongly generated. Previously it was like
/rest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods
but after upgrading Magento version now it's
/checkout/undefinedrest/default/V1/guest-carts/AC72N37Vmo3uGMIXEVQfIDt1ubuZLJws/estimate-shipping-methods
Not sure from where this undefined gets added within the url ??
Research Notes: -
The secure & unsecure base url are correctly setup. I checked it again
Also i navigated to the file from where this ajax call is generated , the file is vendor/magento/module-checkout/view/frontend/web/js/model/shipping-rate-processor/new-address.js
Here the storage.post is from the ajax call is generated and it has serviceurl & payload as arguments.
in getRates function - if we console.log "serviceUrl" then it shows the below url
rest/default/V1/guest-carts/FsS4QvllSq1vpuxZuC8ycQa0VRMOcQCy/estimate-shipping-methods
which seem to be correct, storage.post() function takes this as an argument and ajax request is called which then gets into the .fail() function
so what i think is that the problem is where the front part of the url gets added to it for making the ajax call that is http://sitename.local/checkout/undefined ---> and here somehow the undefined gets added which breaks the whole url
The same issue is encountered by other users also but no solution is available yet.
https://magento.stackexchange.com/questions/256273/undefined-rest-api-checkout-cart https://community.magento.com/t5/Magento-2-x-Programming/Magento2-Wrong-base-url-on-ajax-call/td-p/435435
Can anyone help me out from this?
