[Symfony 5]Bad gateway error on call only if i don't have dumps in my php script

183 Views Asked by At

My symfony application call a route when I have a Soap Call in it and when this one is in error, instead of pass from try to catch, I have an "502 Bad Gateway Error", only if I don't dump the exception.

For information, my Symfony is in 5.4 version and use api-platform to handle routes / conversions / etc. I'm in PHP 7.4

Here an example of the script called in the route

try {
    $arrContextOptions=stream_context_create(
        [
            'ssl' => [
                'verify_peer'      => false,
                'verify_peer_name' => false,
            ],
        ]
    );
    
    $soapClient = new \SoapClient($clientUrl,
        array(
            'trace'          => false,
            'exceptions'     => true,
            'cache_wsdl'     => 0,
            'stream_context' => $arrContextOptions,
        ));

    $header = new \SoapHeader($auth,
        'Token',
        $token);
    $soapClient->__setSoapHeaders($header);

    $result = $soapClient->SendToApi($leadNormalize);
} catch (\Exception $e) {
    $this->logger->error($e->getMessage())
}

If you add a dump in try or catch, 502 error will not be raised and error exception will be correctly done. But in production or qualification, dump is not active and i don't think it's a correct way to fix this issue.

The bad gateway appears after 1-2 seconds, not after 30 seconds / max_execution time is exceeded

In my tries to fix this issue, i've try this :

1/ I've increased buffer sizes for my nginx but configuration of this legacy project is so broken i'm not sure it was effective. (I've added these params :

fastcgi_buffer_size 256k;
fastcgi_buffers 4 512k;
fastcgi_busy_buffers_size 512k;

)

2/ I've passed "trace" to false (Originally to true)

3/ I've reconstructed my docker who handle my back

How to fix this?

0

There are 0 best solutions below