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..

Hello all, I am getting this exception inside a client stub: `Spryker\Shared\ZedRequest\Client\Exce

U048WDEP3R7
U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

Hello all,

I am getting this exception inside a client stub:
Spryker\Shared\ZedRequest\Client\Exception\TransferNotFoundException - Exception: No class name given for Transfer generation.

When I call this function:

public function addAntelopeToQueue(AntelopeTransfer $antelopeTransfer): TransferInterface
{
    return $this->zedRequestClient->call(
        '/bucket-importer/gateway/add-antelope-to-queue',
        $antelopeTransfer
        );

}

Can someone please help?

Comments

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    Do you return a transfer in the gateway controller action?
    \Spryker\Shared\ZedRequest\Client\AbstractZedClient::call assumes that the response from Zed is a transfer.
    And in \Spryker\Zed\ZedRequest\Communication\Plugin\GatewayControllerListenerPlugin::getResponse the return from the controller action is only passed into the response if it is a transfer.
    I'm not even sure if it is possible to return null as a result. By looking through all GatewayController actions from Spryker I haven't found any that does not return a transfer.

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    The gateway controller is returning a Symfony\Component\HttpFoundation\Response; object. Something like this: return (new Response())->setContent(json_encode($antelopeTransfer->toArray()));

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    And that's wrong. A GatewayController should only return a transfer object, never a Symfony response.

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    Instead of return (new Response())->setContent(json_encode($antelopeTransfer->toArray()));
    just do return $antelopeTransfer and you are fine

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    Thanks, but now I am getting a new error

    Spryker\Shared\ZedRequest\Client\Exception\RequestException - Exception: Failed to complete request with server authority <http://backend-gateway.de.spryker.local>.
    Configured with (SSL Disabled) backend-gateway.de.spryker.local: in /data/config/Shared/config_default.php. Error: Stacktrace:
    
    <div style="font-family: Helvetica, Arial, sans-serif; font-size: 14px"><h1>ZED Exception</h1>
        <div style="background: #dadada; padding: 5px"><font style="12"><b>Symfony\Component\HttpKernel\Exception\ControllerDoesNotReturnResponseException
            - The controller must return a "Symfony\Component\HttpFoundation\Response" object but it returned an object of
            type Generated\Shared\Transfer\AntelopeTransfer.</b></font></div>
        <p>in /data/src/Pyz/Zed/BucketImporter/Communication/Controller/GatewayController.php (37)</p>
        <p><b>Url:</b>/bucket-importer/gateway/add-antelope-to-queue</p>
        <p><b>Trace:</b></p>
        <pre>#0 /data/vendor/symfony/http-kernel/HttpKernel.php(156): ()
    #1 /data/vendor/symfony/http-kernel/HttpKernel.php(78): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
    #2 /data/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(132): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
    #3 /data/vendor/spryker/application/src/Spryker/Shared/Application/Application.php(110): Spryker\Shared\Application\Application->handle(Object(Symfony\Component\HttpFoundation\Request))
    #4 /data/public/BackendGateway/index.php(20): Spryker\Shared\Application\Application->run()
    #5 {main}</pre>
    </div>
    ...
    
  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    Does your controller extends AbstractGatewayController?

  • U048WDEP3R7
    U048WDEP3R7 Posts: 217 🧑🏻‍🚀 - Cadet

    Wow that was the problem, It was extending AbstractController instead. Thank you very much.

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    You are welcome 😉