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

Potential Bug In Local By Flywheel Lightning on Windows #87

Closed
richaber opened this issue Aug 21, 2020 · 14 comments
Closed

Potential Bug In Local By Flywheel Lightning on Windows #87

richaber opened this issue Aug 21, 2020 · 14 comments
Assignees
Labels
documentation Something about our documentation needs updated enhancement New feature or request

Comments

@richaber
Copy link
Contributor

Describe the bug

WordPress Support Thread: https://wordpress.org/support/topic/impossible-to-connect-please-check-your-algolia-application-id/

It appears that WP Search with Algolia version 1.4.0, running on Local By Flywheel Lightning, in a Windows Host machine, has difficulty connecting to Algolia's servers, and displays the following message on the settings screen...

Impossible to connect, please check your Algolia Application Id.

Screenshots

image__1_

Additional context

Downgrading WP Search with Algolia to version 1.3.0, appears to work for the two Windows/Local Lightning users that have tested that so far.

I do not have Windows to test with, and am relying on user reports (2 that I am aware of) to help diagnose/debug.

I am considering writing a new CLI command for testing issues such as this. I have done some legwork in another branch that may prove useful for that.

I have seen reports of Algolia PHP Search Client and Laravel Scout (which uses the Algolia PHP Search Client) users overcoming an issue that sounds identical by installing a certificate on their server and updating their php.ini to include it. This is the least noisy and most concise explanation that I have seen for that: https://onlaravel.com/83-quickfix-for-impossible-to-connect-please-check-your-algolia-application-id

I have not been able to confirm if installing the certificate in Local Lightning and updating the php.ini solves the issue, and I do not fully understand how Local Lightning works on Windows, so providing support for that may be difficult.

It appears that the Algolia PHP Search Client removed resources/ca-bundle.crt in version 2.0.0, and my primary hypothesis at the moment is that the removal of the cert file from the Client may be causing Client cURL requests to fail SSL verification.

Screen Shot 2020-08-21 at 6 04 02 PM

This might end up being a server configuration issue, if we can't identify some other obvious code issue. Downgrading the Algolia PHP Search Client within the plugin does not seem like a good idea, since we would lose any bugfixes and improvements.

@richaber richaber self-assigned this Aug 21, 2020
@richaber richaber added the bug Something isn't working label Aug 21, 2020
@dingman
Copy link

dingman commented Aug 21, 2020

Following, thanks Richard!

@richaber
Copy link
Contributor Author

This is looking more and more like a server configuration issue
https://localwp.com/community/t/problem-with-cert/19625

I am trying integrate with Algolia. But i think i have a certificate problem. Because here is same 1 problem.

I downloaded latest certificate from https://curl.haxx.se/ca/cacert.pem and added this line to site/conf/php php.ini.hbs

curl.cainfo="C:\Users\dev\Documents\Sites\site\conf\php\cacert.pem"

Restarted local. It shows in php.ini

But not working. Still getting cert error. I am using Windows 10 and Local 5.4.1+3311

@dingman
Copy link

dingman commented Aug 28, 2020

@richaber thanks for looking deeper. Still strange to me though, version 1.3.0 of this plugin works fine, but 1.4.0 breaks. Could there be some resiliency added in 1.4.0 to account for this difference?

@richaber
Copy link
Contributor Author

@dingman

The biggest difference between version 1.3.0 and 1.4.0 of the plugin, is that we upgraded the bundled official Algolia PHP API Client from 1.23.0 to 2.7.0.

From what I have read in the code, other than API changes, and some method replacements, the biggest difference that could have an impact on this particular issue, that I can determine, is that they removed their own certificate bundle from the client.

I think we might be able get around that by implementing our own cURL options, but I need to test that.

@richaber
Copy link
Contributor Author

@dingman are you able to modify the php.ini in your local environment?

@dingman
Copy link

dingman commented Aug 28, 2020

@richaber yes

@daveromsey
Copy link
Contributor

daveromsey commented Aug 28, 2020

Hello @dingman,

I've been troubleshooting this with @richaber and we have a workaround for now. We've discovered that the issue seems to be something specific to Local Lightning on Windows, and that the plugin does work under Xampp. If we use the certificate provided with Xampp in a Local site's setup, then we can successfully connect to Algolia's server using v1.4 of the plugin.

Here's a copy of the certificate provided with xampp: curl-ca-bundle.zip

Just for the record the Xampp version I used is 7.4.1 and it's available here, if you'd like to get it directly from Xampp's maintainers: https://sourceforge.net/projects/xampp/files/XAMPP%20Windows/7.4.1/

I edited my Local site's D:\dev\local-sites\wp-algolia\conf\php\php.ini.hbs file and pointed it to my Xampp install's certificate file under the [curl] section, which I also had to add. It looks like this:

[curl]
; A default value for the CURLOPT_CAINFO option. This is required to be an absolute path.
curl.cainfo = "d:\dev\xampp\apache\bin\curl-ca-bundle.crt"

Note that your paths will be different. I've added mine for context. You can place the curl-ca-bundle.crt file in a different location, just make sure that the appropriate path is used in the curl.cainfo setting.

After that, just restart your Local site, and you should be in business.

image

Windows 10 Pro v2004, Local v5.7.2+408, Site: PHP 7.3.5, Nginx, MySQL 5.7.28

@dingman
Copy link

dingman commented Aug 28, 2020

@daveromsey I have done what you suggested, however the issue still persists. TIA for any next steps.

@dingman
Copy link

dingman commented Aug 28, 2020

Actually, I was mistaken. My update hadn't saved properly. Upon updating it, it seems like I'm making progress. I'll confirm once I have more updates.

@dingman
Copy link

dingman commented Aug 28, 2020

Looks like that solved it! Great, thank you. I'll file a bug with LocalWP on this.

@dingman
Copy link

dingman commented Aug 28, 2020

For reference: https://localwp.canny.io/bug-reports/p/self-signed-ssl-missing

richaber added a commit that referenced this issue Aug 28, 2020
richaber added a commit that referenced this issue Aug 28, 2020
richaber added a commit that referenced this issue Aug 28, 2020
richaber added a commit that referenced this issue Aug 28, 2020
richaber added a commit that referenced this issue Aug 28, 2020
richaber added a commit that referenced this issue Aug 30, 2020
richaber added a commit that referenced this issue Aug 30, 2020
@richaber
Copy link
Contributor Author

I am leaving this ticket open for my own reference, while I work through a potential "out-of-the-box" solution in a try branch.

@richaber richaber added documentation Something about our documentation needs updated enhancement New feature or request and removed bug Something isn't working labels Sep 26, 2020
@richaber
Copy link
Contributor Author

We should document this in the wiki in #90 (if we get that in progress before the "try" branch I've been looking into for including our own cURL cert).

@garubi
Copy link

garubi commented Feb 9, 2021

I can confirm that following the steps from #87 (comment) I got it working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Something about our documentation needs updated enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants