THIS IS ARCHIVED DOCUMENTATION

Troubleshooting a Coveo Search REST Endpoint Error

On-Premises only

Symptoms

If your Coveo index and Sitecore instance are on separate machines or if you use a Network Load Balancer (NLB), you might see the following error in the Coveo for Sitecore Diagnostic Page:

The remote server returned an error: (400) Bad Request.
System.Net.WebException: The remote server returned an error: (400) Bad Request.
    at System.Net.HttpWebRequest.GetResponse()
    at Coveo.SearchProvider.Applications.StateVerifier.<>c__DisplayClassd.<GetRestEndpointState>b__c()
    at Coveo.SearchProvider.Applications.BaseVerifier.VerifyComponent(Func`1 p_VerifyMethod, String p_ComponentName)

Causes

This error message means that the Coveo for Sitecore Diagnostic Page couldn’t verify the REST endpoint connectivity.

This can happen for many reasons:

  1. Having an invalid <searchApiUri> value in the Coveo.SearchProvider.Rest.Custom.config file.

  2. Having an invalid <applicationSecret> value in the Coveo.SearchProvider.Rest.Custom.config file.

  3. The Coveo Search API was installed without checking the This installation is part of a Sitecore integration checkbox.

  4. Having an invalid Coveo Search Service URI in the Coveo Search API config.yml file. You can find this URI under the server section (see red frame in the code below).

  5. The serverCertificatePath and/or clientCertificatePath attributes could have empty values in the config.yml file (see green frames in the code below). The values provided for these attributes could also be invalid, which means they would lead to nonexistent files.

Resolution

The following list contains the respective solutions to the causes mentioned in the previous section.

  1. The value of <searchApiUri> in the Coveo.SearchProvider.Rest.Custom.config file must be http://<yourCoveoSearchApiServer>:8080/.

  2. Replace the value in the `Coveo.SearchProvider.Rest.Custom.config` file with the one specified in the Coveo Search API `config.yml` file.

  3. Make sure that allowImpersonate: true is located under the Sample Application section in the config.yml file.

  4. The Coveo Search Service URL must be set to https://<yourCoveoEnterpriseSearchServer>:52810 in the Coveo Search API config.yml file.

  5. There are two different solution to the ` serverCertificatePath/clientCertificatePath` attributes issue depending on the machine the Coveo Search API has been installed on:

    1. If the Coveo Search API has been installed on the same machine as the Sitecore instance or on an external machine, fill in attributes values by hand. Copy local certificates from the Coveo index to the machine hosting the Coveo Search API. Then, add pathways to the file locations.

    2. If the Coveo Search API has been installed on the same machine as the Coveo index, use the local certificates to fill in the attribute values.

Solving this issue also implies that you check the logs of all components involved in a search query. When done, you should have found which one generates the error.

  • Sitecore logs: <YOUR_SITECORE_INSTANCE_DATA_FOLDER_PATH>\logs

  • Coveo Search API logs: C:\Program Files\Coveo Search API 8\logs

  • Coveo Enterprise Search query logs: C:\CES7\Index\Default\Log

You should then load the following URLs, which are in fact services, to see whether they’re accessible or not.

  • Coveo for Sitecore REST endpoint proxy : http://yourSitecoreInstanceUrl/coveo/rest

  • Coveo Search API REST endpoint : http://yourCoveoSearchApiServer:8080/rest/search

  • Search Service of Coveo Enterprise Search : http://yourCoveoEnterpriseSearchServer:52810/7.0/CoveoSearchService

Then, ensure that these services are running on their respective host servers. The service names are:

  • Sitecore IIS website

  • Coveo Search API service

  • Coveo Enterprise Search 7 x64 service

If the issue is still not resolved at this point, try the following steps:

  1. Uninstall and reinstall the Coveo Search API service, either on the Sitecore instance machine, the Coveo index machine or on a separate machine. If you want, you could use a NBL to install it on more than one machine.

  2. Start the Coveo Search API service.

  3. Refresh the Diagnostic Page.