Hello to everybody,
we got some problem with the Shopware [AppTemplate] (GitHub - shopware/AppTemplate) and the Shopware 6 Test-Instance (The instance to test bevor you give an App to the Review).
When trying to authenticate with the Shopware 6 app test environment to send a request to the Shopware instance, the core code of the AppTemplate throws an exception. This is thrown by a 302 Http status code:
GuzzleHttp\Psr7\Response^ {#160
-reasonPhrase: "Found"
-statusCode: 302
-headers: array:6 [
"Content-Length" => array:1 [
0 => "138"
]
"Content-Type" => array:1 [
0 => "text/html"
]
"Date" => array:1 [
0 => "Fri, 19 Aug 2022 13:16:47 GMT"
]
"Location" => array:1 [
0 => "http://xxx-dxifv.sw-testenvironment.de/shop/public/"
]
"Server" => array:1 [
0 => "nginx"
]
"Vary" => array:1 [
0 => "Accept-Encoding"
]
]
-headerNames: array:6 [
"content-length" => "Content-Length"
"content-type" => "Content-Type"
"date" => "Date"
"location" => "Location"
"server" => "Server"
"vary" => "Vary"
]
-protocol: "1.1"
-stream: GuzzleHttp\Psr7\Stream^ {#156
-stream: stream resource {@242
wrapper_type: "PHP"
stream_type: "TEMP"
mode: "w+b"
unread_bytes: 0
seekable: true
uri: "php://temp"
options: []
}
-size: null
-seekable: true
-readable: true
-writable: true
-uri: "php://temp"
-customMetadata: []
}
}
PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 22
PHP Warning: Trying to access array offset on value of type null in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23
TypeError {#163
#message: "Shopware\AppBundle\Client\Credentials::__construct(): Argument #1 ($tokenType) must be of type string, null given, called in /vendor/shopware/app-bundle/src/Client/Credentials.php on line 23"
#code: 0
#file: "./vendor/shopware/app-bundle/src/Client/Credentials.php"
#line: 9
trace: {
./vendor/shopware/app-bundle/src/Client/Credentials.php:9 { …}
./vendor/shopware/app-bundle/src/Client/Credentials.php:23 { …}
./vendor/shopware/app-bundle/src/Client/ShopClient.php:94 { …}
./vendor/shopware/app-bundle/src/Client/ShopClient.php:70 { …}
./vendor/shopware/app-bundle/src/Client/ShopClient.php:32 { …}
./src/Helper/ShopFunctions.php:45 {
App\Helper\ShopFunctions::getCurrencies(ShopClient $client)^
› 'api/search/currency',
› body: json_encode([])
› ));
}
./src/Command/DiscountCommand.php:55 { …}
./vendor/symfony/console/Command/Command.php:299 { …}
./vendor/symfony/console/Application.php:1006 { …}
./vendor/symfony/framework-bundle/Console/Application.php:96 { …}
./vendor/symfony/console/Application.php:295 { …}
./vendor/symfony/framework-bundle/Console/Application.php:82 { …}
./vendor/symfony/console/Application.php:167 { …}
./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:56 { …}
./vendor/autoload_runtime.php:35 { …}
./bin/console_2:11 { …}
}
The calling code:
static function getCurrencies(ShopClient $client)
{
$currencyResponse = $client->sendRequest(new Request(
'POST',
'api/search/currency',
body: json_encode([])
));
return json_decode($currencyResponse->getBody()->getContents(), true);
}
We already opened an issue at Github:
Thanks for looking at!