• Resolved igarciaoliver

    (@igarciaoliver)


    Hello everyone.

    Since the latest update, I am getting an error with some calls to the REST API.

    My site is hosted on siteground and the Siteground optimizer plugin encounters erros when trying to connect to the Rest API.

    This shows on my error_log after a failed call to domain.com/wp-json/siteground-optimizer/v1/fetch-options

    [20-May-2021 19:56:54 UTC] PHP Fatal error: Uncaught Error: Call to a member function needs_shipping() on null in /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/includes/class-wc-gateway-amazon-payments-advanced.php:1572

    Is there a solution other than editing the plugin code to check if WC()->cart exists on this line?

    $needs_shipping = WC()->cart->needs_shipping();

    thanks in advance.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter igarciaoliver

    (@igarciaoliver)

    Follow up, I added the conditional and get a new error on line 661 where another call to WC() is made.
    So I added…..

    public function get_checkout_session_id() {
    		$session_key = $this->get_checkout_session_key();
    		// add this escape
    		if ( is_null( WC()->session ) ) {
    			return false;
    		}
    		return WC()->session->get( $session_key, false );
    	}
    

    but this doesn’t look a good solution.

    Plugin Support Christian

    (@christian1983)

    Hey @igarciaoliver

    I will check with the development team and get back to you!

    Best,
    Christian

    Thread Starter igarciaoliver

    (@igarciaoliver)

    Hi @christian1983 any news with this?

    I also got a more scary error today.

    [24-May-2021 05:22:40 UTC] PHP Fatal error:  Uncaught Exception: Unable to send request, underlying exception of getaddrinfo() thread failed to start
     in /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/HttpCurl.php:73
    Stack trace:
    #0 /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/HttpCurl.php(60): Amazon\Pay\API\HttpCurl->execute(Resource id #1403)
    #1 /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/HttpCurl.php(97): Amazon\Pay\API\HttpCurl->httpSend('GET', 'https://pay-api...', NULL, Array)
    #2 /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/Client.php(473): Amazon\Pay\API\HttpCurl->invokeCurl( in /home/customer/www/domain.com/public_html/wp-content/plugins/woocommerce-gateway-amazon-payments-advanced/vendor/amzn/amazon-pay-api-sdk-php/Amazon/Pay/API/HttpCurl.php on line 73
    Plugin Support Christian

    (@christian1983)

    Hey @igarciaoliver

    I just opened an issue on the Amazon Pay repo. The development team is checking.

    Best,
    Christian

    Plugin Support Christian

    (@christian1983)

    Hey @igarciaoliver

    I’m going to mark this as resolved since the issue is being fixed by the developmnet team. If you have any further questions, you can start a new thread.

    Best,
    Christian

    Thread Starter igarciaoliver

    (@igarciaoliver)

    hi @christian1983 where can I check progress by the dev team? thanks

    Plugin Support Christian

    (@christian1983)

    Hey @igarciaoliver

    Hope you are doing well!

    was this issue fixed with the version 2.0.3?

    Best,
    Christian

    Thread Starter igarciaoliver

    (@igarciaoliver)

    Hi @christian1983 I will check and let you know

    Thread Starter igarciaoliver

    (@igarciaoliver)

    Seems to be working fine. Thanks!

    Plugin Support Christian

    (@christian1983)

    Happy to hear!

    Thanks.
    Christian

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Error 500 when calling Rest API’ is closed to new replies.