Redirection makes the cli fails
nidup opened this issue · comments
In case the PIM server answers a 302 (http to https for instance), the cli fails with the following exception (passing null in the paginator because the cli tries to json_decode an invalid content).
We should raise a proper exception when a 302 is encountered.
PHP Fatal error: Uncaught TypeError: Argument 1 passed to Akeneo\Pim\Pagination\PageFactory::createPage() must be of the type array, null given, called in /opt/vendor/akeneo/api-php-client/src/Pagination/Page.php on line 141 and defined in /opt/vendor/akeneo/api-php-client/src/Pagination/PageFactory.php:30
Stack trace:
#0 /opt/vendor/akeneo/api-php-client/src/Pagination/Page.php(141): Akeneo\Pim\Pagination\PageFactory->createPage(NULL)
#1 /opt/vendor/akeneo/api-php-client/src/Pagination/Page.php(78): Akeneo\Pim\Pagination\Page->getPage('http://demo-saa...')
#2 /opt/vendor/akeneo/api-php-client/src/Pagination/ResourceCursor.php(60): Akeneo\Pim\Pagination\Page->getNextPage()
#3 /opt/src/Akeneo/ApiSandbox/Infrastructure/WebApi/LocaleRepositoryInitializer.php(21): Akeneo\Pim\Pagination\ResourceCursor->next()
#4 /opt/src/Akeneo/ApiSandbox/Infrastructure/Cli/GenerateProductsCommand.php(136): Akeneo\ApiSandbox\Infrastructure\WebApi\LocaleRepositoryInitializer->initialize(Object(Akeneo\ApiSandbox\Infrastructure\Database\InMemoryLocal in /opt/vendor/akeneo/api-php-client/src/Pagination/PageFactory.php on line 30
Fatal error: Uncaught TypeError: Argument 1 passed to Akeneo\Pim\Pagination\PageFactory::createPage() must be of the type array, null given, called in /opt/vendor/akeneo/api-php-client/src/Pagination/Page.php on line 141 and defined in /opt/vendor/akeneo/api-php-client/src/Pagination/PageFactory.php on line 30
TypeError: Argument 1 passed to Akeneo\Pim\Pagination\PageFactory::createPage() must be of the type array, null given, called in /opt/vendor/akeneo/api-php-client/src/Pagination/Page.php on line 141 in /opt/vendor/akeneo/api-php-client/src/Pagination/PageFactory.php on line 30
It has been fixed in all the version as a patch.