cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.1.9 Throwing 501 When User is Logged in

SOLVED

Magento 2.1.9 Throwing 501 When User is Logged in

Hi community,

 

I've posted this on magento.stackexchange.com but I didn't really get any helpful responses. Does anybody here have any ideas?

 

I'm having an issue with my 2.1.9 Magento site where a guest user can checkout with PayPal without any issue but when a logged in user attempts to they're unable to.

During the checkout process there is a call to /rest/default/V1/carts/mine/selected-payment-method after you select PayPal as the payment method you wish to use.

The data sent to the server in this call is:

 

 

{"cartId":"10","method":{"method":"paypal_express","po_number":null,"additional_data":null}}

 

The response is:

 

 

{"method":null}

 

 

The call also returns a 501 which leads to an exception being thrown in the JS.

The JS that powers this is:

 

 

define(
    [
        'jquery',
        'Magento_Checkout/js/model/quote',
        'Magento_Checkout/js/model/url-builder',
        'mage/storage',
        'Magento_Checkout/js/model/error-processor',
        'Magento_Customer/js/model/customer',
        'Magento_Checkout/js/model/full-screen-loader'
    ],
    function ($, quote, urlBuilder, storage, errorProcessor, customer, fullScreenLoader) {
        'use strict';

        return function (messageContainer) {
            var serviceUrl,
                payload,
                method = 'put',
                paymentData = quote.paymentMethod();

            /**
             * Checkout for guest and registered customer.
             */
            if (!customer.isLoggedIn()) {
                serviceUrl = urlBuilder.createUrl('/guest-carts/:cartId/set-payment-information', {
                    cartId: quote.getQuoteId()
                });
                payload = {
                    cartId: quote.getQuoteId(),
                    email: quote.guestEmail,
                    paymentMethod: paymentData
                };
                method = 'post';
            } else {
                serviceUrl = urlBuilder.createUrl('/carts/mine/selected-payment-method', {});
                payload = {
                    cartId: quote.getQuoteId(),
                    method: paymentData
                };
            }
            fullScreenLoader.startLoader();

            return storage[method](
                serviceUrl, JSON.stringify(payload)
            ).fail(
                function (response) {
                    errorProcessor.process(response, messageContainer);
                    fullScreenLoader.stopLoader();
                }
            );
        };
    }
);

 

 

Console Showing ErrorsConsole Showing Errors

Has anybody ever experienced any issue like this before? I've tried looking around forums and googling but I've not found anything like this issue.

 

If anybody has any suggestions that would be amazing.

 

Many thanks.



1 ACCEPTED SOLUTION

Accepted Solutions

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Found the issue, Magento had nothing to do with it.

The problem was caused by an Apache config issue.

For reference please see this post.

View solution in original post

5 REPLIES 5

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Hello @JaxkWilko

 

are you using any custom module like restrict payment method or something?

 

If yes then disable such a module and deploy all thing and check again.

 

 

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Hi Sunil,

 

The only custom payment module we have is Magenest_Worldpay which I have now disabled.

 

Ran:

 

php -d memory_limit=-1 -f magento module:disable Magenest_Worldpay
php -d memory_limit=-1 -f magento setup:di:compile
php -d memory_limit=-1 -f magento cache:clean
php -d memory_limit=-1 -f magento cache:flush

 

After doing this the issue is still present.

 

Many thanks.

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Hello,

 

Can you please check server log for same?


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Found the issue, Magento had nothing to do with it.

The problem was caused by an Apache config issue.

For reference please see this post.

Re: Magento 2.1.9 Throwing 501 When User is Logged in

Great!!.

 

 

 


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer