Troubleshooting a Coveo Search REST Endpoint Error
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:
-
Having an invalid
<searchApiUri>
value in theCoveo.SearchProvider.Rest.Custom.config
file. -
Having an invalid
<applicationSecret>
value in theCoveo.SearchProvider.Rest.Custom.config
file. -
The Coveo Search API was installed without checking the This installation is part of a Sitecore integration checkbox.
-
Having an invalid Coveo Search Service URI in the Coveo Search API
config.yml
file. You can find this URI under theserver
section (see red frame in the code below). -
The
serverCertificatePath
and/orclientCertificatePath
attributes could have empty values in theconfig.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.
-
The value of
<searchApiUri>
in theCoveo.SearchProvider.Rest.Custom.config
file must behttp://<yourCoveoSearchApiServer>:8080/
. -
Replace the
value in the `Coveo.SearchProvider.Rest.Custom.config` file with the one specified in the Coveo Search API `config.yml` file. -
Make sure that
allowImpersonate: true
is located under theSample Application
section in theconfig.yml
file. -
The Coveo Search Service URL must be set to
https://<yourCoveoEnterpriseSearchServer>:52810
in the Coveo Search APIconfig.yml
file. -
There are two different solution to the ` serverCertificatePath
/
clientCertificatePath` attributes issue depending on the machine the Coveo Search API has been installed on:-
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.
-
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:
-
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.
-
Start the Coveo Search API service.
-
Refresh the Diagnostic Page.