-
Notifications
You must be signed in to change notification settings - Fork 13
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
guzzlehttp/psr7 version incompatible #111
Comments
Further to this, I assume the obvious fixes are to either:
Can you please confirm what is the best solution? Thanks again, |
Hi @365Dave, Thank you for raising this and giving some potential fixes (super helpful for someone who is not a PHP expert). Just to let you know that I've been able to replicate this and get the following error:
I don't think there is anything too intentional going on here, this is likely a bug/mistake. Let me do some further investigation and come back to you on what fix may be most appropriate! |
Just a quick one before I head off for the weekend. I've tried your second suggested fix and downgraded to "php-http/curl-client": "1.7.1". However I get a different error message this time.
We will have to look into this a bit more on Monday! |
Hi @idavidmcdonald, Thank you for your extremely quick response - I really appreciate it. With regard to downgrading the "php-http/curl-client", I tried this straight after posting my message and I also got the same result. Worth a try never the less! I will await your further findings with this issue. Thanks again, |
I am also attempting to upgrade and I am hitting the same issue. We were advised to upgrade by 5th July due to infrastructure changes at notify. Could you advise whether it will be possible to fix this issue by then? Or alternatively confirm the highest working version that will satisfy the requirement to upgrade. I have copied the message we received from Notify. We haven't noticed an increase in failures, so perhaps we don't need to do anything at this point? Message from Notify: On Tuesday 5 July, we’re moving all our API traffic to AWS Cloudfront. We’ve already migrated 95% of our traffic, and have been working with services to find and fix any issues. If you’ve noticed more errors than usual in the last 2 months, please update your API integration before 5 July. If you manage multiple services, you should check and update all API integrations. If you rely on an external provider for managing your service(s), you should ask them to check the error rates for you. Thanks, |
Hi both, I'm afraid I don't have an answer yet (I'm hoping to get some more done on this today/tomorrow). However one thing I will just raise in case it is helpful which might take the pressure off upgrading. You only need to upgrade your version of our PHP API client if you are currently seeing errors when sending requests to our API. This is because 95% of your requests are already going through our new infrastructure and you would be seeing a large number of errors already if there was a problem. The advice to upgrade is there because we are aware that in versions < 5.0.1 of our Python client, there is an issue that it sends GET requests with a body (albeit an empty body) which Cloudfront rejects. We are not aware of this issue or any other issues with any of our other clients or other versions. But if teams are seeing errors then upgrading your client is one approach to try and see if this solves it, in case you've stumbled across a different problem. You are welcome to upgrade still when we get this fixed, but this is in your own time and there is no deadline from us. Sorry this wasn't clearer in our email! Do let me know if that takes the pressure off you to upgrade before 5 July please? And we will continue looking at a solution for this. |
Thanks for getting back to us on this matter @idavidmcdonald. Personally I have changed my implementation to the latest Guzzle v6 variant. This works well and caused little problems to integrate into my code. Dave |
Hi there, Thanks for your reply @idavidmcdonald. We don't see any errors with our current implementation, we only get an error when we do the update in our Drupal website. We are already using Guzzlev6 and followed the instructions as outlined here https://docs.notifications.service.gov.uk/php.html#set-up-the-client but the suggested code This code was working just fine with the version 1.6.2 of the package. Can you advise please? Thanks, |
Hi, So we've done some more digging on this. We accidentally removed support for all versions of the curl client in version 3.0.0 of this API clientIn version 3.0.0 of this API client, we brought in a requirement for HTTP clients to be PSR7 compliant. We forgot to test whether the curl client would continue to work with this change. It turns out that the curl client is not PSR7 compliant. No version of the curl client has ever been PSR7 compliant, nor will it be (they have moved straight to PSR17 compliance, skipping PSR7). This means that if you want to upgrade to version 3 or higher of our client, it is not currently possible to use any version of the curl client. We plan to update our documentation to make it correct on what we currently supportThis would involve dropping the documentation for using the curl client with our PHP client. We have checked and our implementation for Guzzle 6 (using the Guzzle 6 adaptor to make it PSR7 compliant) still works. We have checked and Guzzle 7 also works so we will add this to our documentation. We need to check our implementation for Guzzle 5 (using the Guzzle 5 adaptor to make it PSR7 complaint) still works and update the documentation if needed. We plan to put in some better automated testing to ensure that any future changes won't break integrations with any HTTP clients we are supporting. We may be able to add support for the curl clientWe think the only way to do this would be to make changes to our API client that make it PSR17 compliant. Both the latest versions of the curl client and Guzzle 7 appear to be PSR17 compliant. This would however mean dropping support for Guzzle 5 and Guzzle 6 as neither are PSR17 compliant. We haven't yet started looking at this. From the crude metric of github stars, Guzzle is about 60 times more popular than the curl client so there is a question about whether we should prioritise it (especially since no one has complained about it being broken for the last 2 years). We would be keen to hear your thoughts on this! Thanks for your patience, |
Hi, would you be able to provide some more details please so we can try and replicate this locally. For example, what version of Also could you confirm if you have this running locally without errors but then running in Drupal with errors? You said 'we only get an error when we do the update' which I wasn't entirely clear on what you mean by that? Any further details would be much appreciated. Thanks, |
Support for cURL was removed in version 3.0.0 of this client without us realising. To make the docs correct, we are therefore removing the instructions on how to use it. We may decide to add back in cURL support but haven't commited to doing so right at this point. For more context, see: #111 (comment)
Hi @idavidmcdonald , So we are currently using "alphagov/notifications-php-client": "1.6.2" and "php-http/guzzle6-adapter": "v1.1.1". In our current implementation, we're already using everything suggested in the documentation, including And using these specific versions ("alphagov/notifications-php-client": "1.6.2" and "php-http/guzzle6-adapter": "v1.1.1"), everything works fine. It's only following the update of the package "alphagov/notifications-php-client" to version 4.0.1 that we started to get the following error: Here's a shortened version of our code ` class DrushCustomCommand extends DrushCommands { public function sendAlert($email) { What I meant by 'we only get an error when we do the update' is that the code was working fine before doing the update of the alphagov package, which makes me think there might be an issue with the newer version, since this was the only change that happened. Does that make sense? And I hope it makes everything a bit clearer. Many thanks! |
Hi @c-ancia, I was able to replicate your issue. The reason for this is because of the change introduced to notifications-php-client in version 3.0 described by @idavidmcdonald above. If you also update your |
Hi,
I have been upgrading from v1.6.2 to v4.0.1 and have hit an issue. I have installed via composer and want to use the curl implementation. I can't connect as per the documentation, as the types of the parameters used to instantiate the curl http client do not match. After some digging I have found that the guzzlehttp/psr7 version specified in the composer.json file is too low. The file is set as ^1.2 but you need a version greater than 2. Is this a known issue or is this done in this way for a reason?
Thanks in advance,
Dave
The text was updated successfully, but these errors were encountered: