What are the Slack Archives?
It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.
Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..
Hi. I'm trying to start with Spryker but unfortunately having troubles at very beginning. In develop
Hi. I'm trying to start with Spryker but unfortunately having troubles at very beginning. In developer bootcamp, there is a challenge to communicate Yves with Zed. I implemented everything mentioned in description, but calling Yves endpoint I got following error:
"RuntimeException: Controller 'Pyz\Zed\Unixslayer\Communication\Controller\GatewayController::reverseAction()' requires that you provide a value for the '$transfer' argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one. in file /data/vendor/symfony/http-kernel/Controller/ArgumentResolver.php on line 80"
After investigating a bit deeper, I found that request, which is send to Zed is created with empty stream. Followup with objects dumped right before Zed call.
Spryker\Client\ZedRequest\Client\Request {#1138 #values: array:8 "host" => "a04cc4aa7478" "metaTransfers" => array:2 "locale" => array:2 "data" => array:4 "locale_name" => "en_US" "id_locale" => null "name" => null "is_active" => null ] "className" => "Generated\Shared\Transfer\LocaleTransfer" ] "currency" => array:2 "data" => array:6 "code" => "EUR" "symbol" => "€" "id_currency" => null "name" => "Euro" "is_default" => true "fraction_digits" => 2 ] "className" => "Generated\Shared\Transfer\CurrencyTransfer" ] ] "password" => null "sessionId" => "7cc997352356cbd15bf0546716418b5e" "time" => "1616096479" "transfer" => array:1 "original_string" => "Hello world!" ] "transferClassName" => "Generated\Shared\Transfer\StringReverseTransfer" "username" => null ] } GuzzleHttp\Psr7\Request {#1161 -method: "POST" -requestTarget: null -uri: GuzzleHttp\Psr7\Uri {#1160 -scheme: "http" -userInfo: "" -host: "zed.us.spryker.local" -port: null -path: "/unixslayer/gateway/reverse" -query: "" -fragment: "" } -headers: array:6 "Host" => array:1 0 => "zed.us.spryker.local" ] "User-Agent" => array:1 0 => "Yves 2.0" ] "X-Yves-Host" => array:1 0 => "1" ] "X-Internal-Request" => array:1 0 => "1" ] "Auth-Token" => array:1 0 => "JDJ5JDA0JElvOC96LzEuVEltYnhHYVRXdFgwY09aR01GVy9hYVpybktleGJFLnJZUVRORzJSWTE4Zmc2" ] "X-Request-ID" => array:1 0 => "7bb946bc" ] ] -headerNames: array:6 "user-agent" => "User-Agent" "x-yves-host" => "X-Yves-Host" "x-internal-request" => "X-Internal-Request" "auth-token" => "Auth-Token" "x-request-id" => "X-Request-ID" "host" => "Host" ] -protocol: "1.1" -stream: null }
Comments
-
hey! Sorry for getting back to you so late. Can you show the GatewayController you created? and also the ZedStub?
0 -
-
@UJN2JRU4F looks like no
$argumentValueResolvers
are passed into\Symfony\Component\HttpKernel\Controller\ArgumentResolver
so it takes default ones and none of them could resolve gateway argument from the request. I saw two implementations of\Symfony\Component\HttpKernel\Controller\ArgumentValueResolverInterface
in Spryker codebase. How exactly is Symfony components configured in Spryker? Is Spryker using autowire/autoconfig?0 -
hi
0 -
no autowire/autoconfig by any means
0 -
gateway controller looks fine
0 -
stub as well
0 -
let’s follow the chain further
0 -
my line of thought: this is a very frequently done and rather mature task, so the basic configuration is likely correct, otherwise people would stumble often. so there is probably some detail off.
0 -
following a principle from the Pragmatic Programmer: “If you see hoof prints think horses, not zebras. ” 😊
0 -
so, now we have to find out where the Stub is actually used. Following the error message, this would probably be the controller
0 -
I'll follow the rabbit hole and return to you with the results 😉
0 -
You could also share a gut diff with your code or so 😊
0 -
@UJN2JRU4F Turned out that my
GatewayController
extendsAbstractController
instead ofAbstractGatewayController
. Everything started to work as expected after change. I was trying to debug this issue more further but decided to go again with the example and copy/paste code samples from training and checking if I did something different. At first attempt I was writing the code by my own.0 -
happens 🤷
0 -
do you have any suggestion what might have helped you identify or even prevent the mistake from our side?
0 -
For this case? Maybe in tutorial you can emphasize that there is a difference between
AbstractController
andAbstractGatewayController
. I read the description, made a brief look atGatewayController
and started to code. Going with copy/paste I could not even notice that.AbstractGatewayController
works differently fromAbstractController
although implementations are made in the same namespace which can be a bit confusing. I think that this should be explained somewhere.0 -
I just noticed, that actions in
AbstractGatewayControllers
can only acceptTransferObjects
so it works totally different fromAbstractControllers
. Took a quick look at documentation, but I don't see any explanation, that they have specific purpose.0 -
the gateway controllers?
0 -
this is indeed the closes thing i found (after 5 mins of search) https://documentation.spryker.com/docs/client#requests-from-yves-to-zed
0 -
@UJN2JRU4F it still doesn't explain the difference between GatewayController and standard Controller. But I guess that this might not be that much of a problem if this is the first time someone had this issue. On the other hand, it could be helpful to point out the purpose and how GatewayControllers actually works.
0 -
agreed
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 76 Spryker News
- 929 Developer Corner
- 787 Spryker Development
- 89 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 26 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random