Skip to content

Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse() in WebPush.php line 185 #300

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

Closed
9 of 14 tasks
swayok opened this issue Sep 30, 2020 · 14 comments
Closed
9 of 14 tasks

Comments

@swayok
Copy link

swayok commented Sep 30, 2020

NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This
helps with diagnosing problems quicker.

Please confirm the following:

  • I have read the README entirely
  • I have verified in the issues that my problem hasn't already been resolved

Setup

Please provide the following details, the more info you can provide the
better.

  • Operating System: Linux
  • PHP Version: 7.4
  • web-push-php Version: 6.0.2

Please check that you have installed and enabled these PHP extensions :

  • gmp
  • mbstring
  • curl
  • openssl

Please select any browsers that you are experiencing problems with:

  • Chrome
  • Firefox
  • Firefox for Mobile
  • Opera for Android
  • Samsung Internet Browser
  • Other

Please specify the versions (i.e. Chrome Beta, Firefox Beta etc).

Problem

Please explain what behaviour you are seeing.

Exception

Expected

Please explain what you expected to happen

No exception

Features Used

  • VAPID Support
  • Sending with Payload

Example / Reproduce Case

Please provide a code sample that reproduces the issue. If there is a
repository that reproduces the issue please put the link here.

Other

Please put any remaining notes here.

It never happened before v6.0.2 but it could be because HTTP request never failed.
Also as I can see - RequestException was expected but ConnectException received.

@nunoperalta
Copy link

Getting this issue too.

Uncaught Error [0]: Call to undefined method GuzzleHttp\Exception\ConnectException::getResponse()
at vendor/minishlink/web-push/src/WebPush.php(185)
Stack trace:
#0 vendor/guzzlehttp/promises/src/Promise.php(204): Minishlink\WebPush\WebPush->Minishlink\WebPush{closure}(Object(GuzzleHttp\Exception\ConnectException))
#1 vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(2, Object(GuzzleHttp\Exception\ConnectException), NULL)
#2 vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise{closure}()
#3 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(158): GuzzleHttp\Promise\TaskQueue->run()
#4 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(183): GuzzleHttp\Handler\CurlMultiHandler->tick()
#5 vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#6 vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#7 vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#8 vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#9 vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#10 vendor/minishlink/web-push/src/WebPush.php(190): GuzzleHttp\Promise\Promise->wait()
#11 myfile.php(125): Minishlink\WebPush\WebPush->flush()
#12 {main}

@wkolcz-UMHS
Copy link

I had the same issue but when I added the following code, the error went away and the logs say successful but I didn't see a notification (which might be a seperate issue)

$auth = [
    'VAPID' => [
        'subject' => 'mailto:[email protected]', // can be a mailto: or your website address
        'publicKey' => '~88 chars', // (recommended) uncompressed public key P-256 encoded in Base64-URL
        'privateKey' => '~44 chars', // (recommended) in fact the secret multiplier of the private key encoded in Base64-URL
    ],
];

$webPush = new WebPush($auth);

@Tchiller
Copy link

Tchiller commented Nov 3, 2020

Related #299

@polzkey
Copy link

polzkey commented Nov 30, 2020

I have the same issue. I am using the latest version v6.0.3.

@francogp
Copy link

same problem here

@rwngallego
Copy link
Contributor

Same problem here, looks like it's affecting v6.0.3

@rwngallego
Copy link
Contributor

In my case it's related to the number of notifications I process in a flush operation (I don't change the default limit to 1.000). If I send 800 that error occurred, however with 200 it's fine. Could this be related to a transitional error caused by out of memory or a network error as in #203 ?

@tbyte80
Copy link

tbyte80 commented Mar 10, 2021

The error is indirectly caused by guzzle. They decided to no longer inherit ConnectException from RequestException, thus the getResponse method is not available anymore. You can see it in the following commit:
guzzle/guzzle@6b77639

There is a pull request above with a fix but a syntax test failed without further details as it seems. However the fix itself is trivial. Either downgrade guzzle to 6.5.5 or check for response availability.

Affected are all versions of this lib from v6.0.0 upwards

Quick fix for your project until the fix is ready:
Add "guzzlehttp/guzzle": "^6.5" to your composer.json to downgrade it. The current version of web-push-php will continue to work with that guzzle version and that error is gone. This works for all projects not depending on guzzlehttp versions >=7.x.

@Alito92
Copy link

Alito92 commented Mar 13, 2021

Hi @tbyte80, the idea you propose is good, this clears the error, but the notifications are not delivered to the devices, my project was working fine, then I started with the error and now I have no errors, but the notifications are not delivered. Any suggestion?

@salimbuet09
Copy link

Is there any working solution yet? I am having exactly same issue.
even downgrading guzzlehttp/guzzle": "^6.5 did not work. the notifications are not delivered with ^6.5

@tbyte80
Copy link

tbyte80 commented Mar 23, 2021

There might be another issue, in /minishlink/web-push/src/Encryption.php on line 390 they are trying to pass a GMP instance to PrivateKey::create which expects BigInteger only.

This prevents my messages to be sent.

@maciek-szn
Copy link

@Minishlink, are you still interested in maintaining your code?

@Minishlink
Copy link
Member

Minishlink commented Apr 8, 2021

Adressed in #299, root cause is #300 (comment)

@ghnp5
Copy link

ghnp5 commented Apr 8, 2021

Besides taking 6 months to approve the pull request, I think everything went very well!
(thanks btw)

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