This error will most often appear if the credentials you are using (the Application ID and the API key) are incorrect. We recommend first checking that the credentials you are using are correct and that your application currently exists.
Once you have confirmed your credentials, you can verify the status of your application's cluster by going to our status page.
You can monitor your server's status on your dashboard as well.
If your credentials are valid and the status page does not indicate issues on your application's cluster, the error likely indicates a DNS or TCP issue. This is the case regardless of the application you are using.
If it is a DNS issue, the request will fail. Increasing the timeout of the request or the retry count will not be effective. In fact, increasing the retry count in this scenario may overload the network even more severely.
Instead, you should try to limit the number of overall requests in order to avoid overloading the network resources. Batching your requests or performing fewer simultaneous requests can help (as discussed in the next section of this article).
For back end indexing, you can increase the ulimit size or pool the TCP connections.
When ulimit is not an option, http agent, http pooling, or a combination of ulimit + http agent would be the next best solution.
For Node.js, UV_THREADPOOL_SIZE is useful.
If you are serving a website on your server, that website will be accessed on users' browsers.
If the connection users make to Algolia is from the browser (a front end connection) and the error is intermittent, the issue may be that users are too far from the Algolia servers to make a connection.
You can test this issue by asking your users to run this connection diagnostic.
If the connection users make to Algolia is from your servers (a back end connection) and the error is intermittent, the issue is less likely to be an issue of geographic location. There are other connection issues you can diagnose using this script.
One possible approach to address this issue is adding a DSN in the appropriate geographic region. Please note that the issue can be specific to individual user networks, so this may not resolve the issue in all cases.
Other Network Issues
If the issue occurs at the same time as search requests and the network has an intermittent issue, increasing the timeout or retry count can be helpful. Here is a sandbox example (for demonstration purposes only, not a recommended implementation) of code that attempts up to 10 retries with custom timeouts.