WordPress - Impossible to connect, please check your Algolia Application Id

I am integrating custom plugin in WordPress but at Importing Existing Content step when running wp algolia reindex_post command it throwing error message “Impossible to connect, please check your Algolia Application Id.”

I already checked my application id and admin key and both are correct still getting error of application id. Also followed previous step properly and set application id and admin key as per previous step

Please help to resolve the issue.

Hey, thanks for reaching out!

If you are sure that the keys are correct, please make sure that your application is not blocked behind a firewall - this can occur when your application is running inside a virtual private cloud network where external connections need to be explicitly allowed.

The settings usually vary between different cloud providers or hosting providers, so please make sure you checked with them too!

Let us know!

Thanks for your reply.

First of all I want to clear that I am integrating it on local system not on dev or prod. Does it required to integrate directly on dev or prod?

Hey! No, it does not. To clarify, you are running the application locally correct? The error you are seeing is tipically occurs when there is a connection issue between your application and the algolia server. This can happen if there is something inbetween blocking a connection like a firewall or proxy.

If your application is not behind any firewall or is not running inside any containers, could you please try running “curl https://$APPID-dsn.algolia.net/1/isalive” where you substitute the $APPID with your application id?

Thank you!

Yes, I am running app locally. I checked by disabling the firewall in my Windows 10 machine and run wp algolia reindex_post but still same error.

I checked the server islive and got message

{“message”:“server is alive”}

Following is the error message :

PHP Fatal error: Uncaught Algolia\AlgoliaSearch\Exceptions\UnreachableException: Impossible to connect, please check your Algolia Application Id. in D:\Projects\test\wp-content\plugins\algolia-custom-integration\vendor\algolia\algoliasearch-client-php\src\RetryStrategy\ApiWrapper.php:187

Below is the code of algolia-custom-integration.php file

Hey! Could you please try the solution provided on this SO post? It solves the same connectivity error on Windows 10.

I already tried this but no success.

Any solution for this issue?

Random thought: are you sure you’re providing a write API key (or the Admin API key) and not a search API key?

I am 100% sure I provided admin key not the search key. Everything is provided correct. I tried by disabling Firewall as well. System is windows 10.

Could you try enabling the debug mode of the PHP client?

\Algolia\AlgoliaSearch\Log\DebugLogger::enable();

This should echo out all the requests done to catch any potential endpoint crafting issue.

1 Like

Thanks man! I got the error by help of debug logger. It was .crt file path issue.

3 Likes

Hello. How you solved this? I don’t see any .crt error on debug log. I have same error on Wordpress. Thank you.

For me it was .crt error and I fixed by setting absolute path for .crt in php.ini like this:

curl.cainfo = “C:\xampp\apache\bin\curl-ca-bundle.crt”

Please post your error log then someone can help to you.

1 Like
[20-May-2020 08:15:29 UTC] PHP Fatal error:  Uncaught Algolia\AlgoliaSearch\Exceptions\UnreachableException: Impossible to connect, please check your Algolia Application Id. in C:\wamp64\www\yurt\wp-content\plugins\yurt-filter\vendor\algolia\algoliasearch-client-php\src\RetryStrategy\ApiWrapper.php:187
Stack trace:
#0 C:\wamp64\www\yurt\wp-content\plugins\yurt-filter\vendor\algolia\algoliasearch-client-php\src\RetryStrategy\ApiWrapper.php(92): Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->request('POST', '/1/indexes/yurt...', Object(Algolia\AlgoliaSearch\RequestOptions\RequestOptions), Array, 30, Array)
#1 C:\wamp64\www\yurt\wp-content\plugins\yurt-filter\vendor\algolia\algoliasearch-client-php\src\SearchIndex.php(280): Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper->write('POST', '/1/indexes/yurt...', Array, Object(Algolia\AlgoliaSearch\RequestOptions\RequestOptions))
#2 C:\wamp64\www\yurt\wp-content\plugins\yurt-filter\wp-cli.php(20): Algolia\AlgoliaSearch\SearchIndex->clearObjects()
#3 [internal function]: Algolia_Command->reindex_post(Array, Array in C:\wamp64\www\yurt\wp-content\plugins\yurt-filter\vendor\algolia\algoliasearch-client-php\src\RetryStrategy\ApiWrapper.php on line 187

It is php.ini (also tried lates cacert.pem)