fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

500 Errors #23

Closed solasus closed 7 years ago

solasus commented 7 years ago

Hi I'm trying to just create some simple calls to get started. I believe, I'm authenticating properly otherwise I'd be seeing a 401 message, but instead: [status code] 500 [reason phrase]

All I'm doing is trying to get a list of feeds or view inventory based on the basic examples use Walmart\Inventory; $client = new Inventory([ 'consumerId' => 'REMOVED', 'privateKey' => 'REMOVED', ]); $inventory = $client->get([ 'sku' => '1006518', // required ]);

Any suggestions...?

CentOS release 6.8 PHP 5.5.21

Full message: Fatal error: Uncaught exception 'GuzzleHttp\Exception\ServerException' with message 'Server error response [url] https://marketplace.walmartapis.com/v2/feeds?limit=50&offset=0 [status code] 500 [reason phrase] Internal Server Error' in /home/walmart/public_html/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/walmart/public_html/vendor/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/walmart/public_html/vendor/guzzlehttp/guzzle/src/Event/Emitter.php(108): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/walmart/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\CompleteEvent)) #3 /home/walmart/public_html/vendor/guzzlehttp/guzzle/src/RequestFsm.php(132): GuzzleHttp\RequestFsm->__invoke(Object(GuzzleHttp\Transaction)) #4 /home/w in /home/walmart/public_html/vendor/guzzlehttp/command/src/AbstractClient.php on line 171

solasus commented 7 years ago

Ok... what's really strange now is that I just ran the script this am and got a result. Looked like correct data and status 200. But seconds later I re-ran it and came up with the same errors as above. ... further investigation looks like APC caching was the culprit.

fillup commented 7 years ago

@solasus good to know, thanks for updating the issue and letting us know what was causing it.

ergoderavinesh commented 6 years ago

I have faced the same problem with single pricing API, how to solve it

Fatal error: Uncaught exception 'GuzzleHttp\Exception\ServerException' with message 'Server error response [url] https://marketplace.walmartapis.com/v2/prices?sku=GSUP-42171&currency=USD&price=50.07 [status code] 500 [reason phrase] Internal Server Error' in /home/icydea5/public_html/inventoryapp/walmart_milind/vendor_walmart/guzzlehttp/guzzle/src/Exception/RequestException.php:89 Stack trace: #0 /home/icydea5/public_html/inventoryapp/walmart_milind/vendor_walmart/guzzlehttp/guzzle/src/Subscriber/HttpError.php(33): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Message\Request), Object(GuzzleHttp\Message\Response)) #1 /home/icydea5/public_html/inventoryapp/walmart_milind/vendor_walmart/guzzlehttp/guzzle/src/Event/Emitter.php(108): GuzzleHttp\Subscriber\HttpError->onComplete(Object(GuzzleHttp\Event\CompleteEvent), 'complete') #2 /home/icydea5/public_html/inventoryapp/walmart_milind/vendor_walmart/guzzlehttp/guzzle/src/RequestFsm.php(91): GuzzleHttp\Event\Emitter->emit('complete', Object(GuzzleHttp\Event\Co in /home/icydea5/public_html/inventoryapp/walmart_milind/vendor_walmart/guzzlehttp/command/src/AbstractClient.php on line 171

solasus commented 6 years ago

This error is usually due to a bad request. Look at your code - you can try adding before the } catch {

die(print_r($feed));

or this might give some clues as well

$inventory->debug($feed);

ergoderavinesh commented 6 years ago

i m using this code

foreach($priceData as $values){ $price_client = new Price([ 'consumerId' => WALMART_CONSUMER_ID, 'privateKey' => WALMART_PRIVATE_KEY, ]);

                try{
                    $price = $price_client->update([
                        'sku' => $values['SKU'], // required
                        'currency' => 'USD', // required
                        'price' => $values['wmart_price'], // required
                    ]);

                    if($price['statusCode'] != 200){
                        $lf1->log(serialize($price));
                    }
                }catch(Exception $ex){
                    $lf1->log($ex->getMessage()."| ".$values['SKU']);                        
                }

                unset($price_client);
            }