Skip to content

Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse() #39544

Open
@sashas777

Description

Preconditions and environment

Steps to reproduce

Before the step: Subscribe to events in Adobe Commerce
Before running the command: npm run commerce-event-subscribe

Add an exception to the Model/IOEventsApi/ApiRequestExecutor.php, Example:

 try {
            $response = $client->request($method, $uri, $params);

            throw new \GuzzleHttp\Exception\ConnectException();

        } catch (GuzzleException $exception) {
            $response = $this->responseFactory->create([
                'status' => $exception->getCode(),
                'reason' => sprintf(
                    'Unsuccessful request: `%s %s` resulted in a `%s %s` response:',
                    $method,
                    $uri,
                    $exception->getResponse()->getStatusCode(),
                    $exception->getResponse()->getReasonPhrase()
                ) . PHP_EOL . $exception->getResponse()->getBody()->getContents()
            ]);
        }

Run npm run commerce-event-subscribe OR bin/magento events:subscribe --fields=sku observer.catalog_product_delete_commit_ater

With a valid exception (when the server response is 403/500/404) There will be an error:

Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse()

In my case, instead of adding an exception, I blocked in the firewall URL https://api.adobe.io/ and it triggered the error.

Expected result

Successful event subscriptions

Actual result

Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse()

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Assignees

Labels

Issue: On HoldReported on 2.4.7-p3Indicates original Magento version for the Issue report.Triage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

Type

No type

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions