looxis / laravel-amazon-mws

Simple Amazon MWS Laravel integration
MIT License
31 stars 10 forks source link

Client error - Truncated response - 400 Bad Request #23

Open ghost opened 3 years ago

ghost commented 3 years ago

Description:

This is my implementation: function orders() { $response = AmazonMWS::orders()->get("1234-1234-1234"); return $response; }

My .env has the correct credentials, but I got a Client error = SignatureDoesNotMatch

Is something missing? Thanks

LooxisDev commented 3 years ago

Hi @jessmnk92 , thanks for trying out this package. The package doesn't handle Exceptions, but you can try catch it for yourself and read out the error response. This package is using the Guzzle HTTP Client. Here is something about the Exceptions: https://docs.guzzlephp.org/en/stable/quickstart.html#exceptions It's truncated by default

try {
            return AmazonMWS::orders()->get("1234-1234-1234");
        } catch (\GuzzleHttp\Exception\RequestException $e) {
            \Log::error($e->getResponse()->getBody()->getContents());
        }

You can log or dump your exception to get the Full Error Response. But you need to check which Exception is the right one you are catching. Could be RequestException or ServerException.

SignatureDoesNotMatch Sounds like something is missing for the signature building. Which marketplace do you set as the default?

Does the list() method work for you? Maybe your Amazon Order ID in the get() method does not exist. "1234-1234-1234" was just a dummy

Also: Your wrote your are using the 0.1 version. Try to update to one of the latest releases: https://github.com/looxis/laravel-amazon-mws/releases

sakibanda commented 2 years ago

I faced the same issue when updated secret key and found for some reason secret_key is not same as MWS_SECRET_KEY in .env

Is this variable cache somewhere?