phplaravelguzzleamazon-selling-partner-api

Issue with Custom Guzzle Client in authenticationClient for SellingPartnerApi::seller()


I'm encountering an issue when passing a custom GuzzleHttp\Client instance as the authenticationClient parameter in SellingPartnerApi::seller(). According to the documentation, this parameter should accept a GuzzleHttp\Client, but when provided, it results in the following error:

Error:

Typed property Saloon\Http\Senders\GuzzleSender::$client must not be accessed before initialization.

Steps to Reproduce Instantiate a GuzzleHttp\Client with a proxy

$httpClient = new \GuzzleHttp\Client([
    'proxy' => 'http://username:password@proxy_host:port',
    'timeout' => 30,
    'connect_timeout' => 30,
]);
// or just an empty client
$httpClient = new \GuzzleHttp\Client();

Pass it to SellingPartnerApi::seller()

$api = SellingPartnerApi::seller(
    clientId: $credentials->api_client_id,
    clientSecret: $credentials->api_client_secret,
    refreshToken: $credentials->refresh_token,
    endpoint: Endpoint::NA,
    authenticationClient: $httpClient
);

Attempt to make a request:

$response = $api->sellersV1()->getMarketplaceParticipations();

Additional Information

I've confirmed that the issue persists even when using a clean GuzzleHttp\Client instance without additional configuration.

Is there an internal constraint preventing the use of a custom GuzzleHttp\Client, or is there a required initialization step that is missing? Any guidance would be appreciated.


Solution

  • Looks like this was a bug and has been fixed in v7.3.0: https://github.com/jlevers/selling-partner-api/issues/848