Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong HTTP status #941

Closed
mariuszsienkiewicz opened this issue Jun 18, 2024 · 2 comments
Closed

Wrong HTTP status #941

mariuszsienkiewicz opened this issue Jun 18, 2024 · 2 comments

Comments

@mariuszsienkiewicz
Copy link

Issue

Issue similar to #894.

Please look at this code:

try {
$this->executeWebhook($transactionId);
} catch (\Throwable $exception) {
$logger->error('Failed to handle webhook', [
'Exception message' => $exception->getMessage(),
'Exception code' => $exception->getCode(),
]);
$errorHandler->handle($exception, $exception->getCode(), false);
$this->releaseLock();
$this->ajaxResponse(JsonResponse::error(
$this->module->l('Failed to handle webhook', self::FILE_NAME),
$exception->getCode()
));
}

It's not a good idea to set HTTP Status based on Exception error code... example:

PHP message: PHP Fatal error:  Uncaught InvalidArgumentException: The HTTP status code "1000002" is not valid. in /<path>/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php:464
Stack trace:
#0 /<path>/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Response.php(207): Symfony\Component\HttpFoundation\Response->setStatusCode(1000002)
#1 /<path>/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/JsonResponse.php(44): Symfony\Component\HttpFoundation\Response->__construct('', 1000002, Array)
#2 /<path>/modules/mollie/src/Infrastructure/Response/JsonResponse.php(28): Symfony\Component\HttpFoundation\JsonResponse->__construct(Array, 1000002, Array)
#3 /<path>/modules/mollie/src/Infrastructure/Response/JsonResponse.php(50): Mollie\Infrastructure\Response\JsonResponse->__construct(Array, 1000002)
#4 /<path>/" while reading response header from upstream, client: <redacted>, server: <redacted>, request: "POST /module/mollie/webhook HTTP/2.0", upstream: "fastcgi://unix:/<redacted>/php-fpm.sock:", host: "<redacted>"

Environment

  • PrestaShop version: 1.7.7.1
  • Mollie module version: 6.1.1
@justelis22
Copy link
Collaborator

Hi @mariuszsienkiewicz, thanks for the information!

I have forwarded everything to our development team, they will overview this and I will get back to you once I have more info.

Best Regards,
Invertus Support team.

@justelis22
Copy link
Collaborator

@mariuszsienkiewicz Hi there,

This was released in version 6.2.2.

Your feedback is highly appreciated!

Best Regards,
Invertus Support team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants