0

I'm running the Postman collection to call Sitecore Commerce (9.0.3 with Sitecore 9.0.2) API methods on my solution. I call GetToken which runs successfully, followed by CleanEnvironment (which completes successfully), followed by InitializeEnvironment, which shows to have failed on calling CheckCommandStatus.

The resulting response on checking CheckCommandStatus is

{
    "@odata.context": "https://localhost:5000/CommerceOps/$metadata#Commands/$entity",
    "@odata.type": "#Sitecore.Commerce.Core.Commands.InitializeEnvironmentCommand",
    "Id": "c6a2a382f576497bb2ef9215b11f49e9",
    "ResponseCode": "Error",
    "Messages": [
        {
            "MessageDate": "2021-07-21T22:47:08.7694426Z",
            "Code": "Error",
            "Text": "Failed to get connection for Sitecore",
            "CommerceTermKey": "ConnectionError"
        }
    ],
    "Models": [],
    "ActionUrl": "",
    "TaskId": 792,
    "Status": "RanToCompletion",
    "IsFaulted": false,
    "IsCompleted": true,
    "IsCanceled": false,
    "StartTime": "2021-07-21T22:47:08.55158Z",
    "ExecutionTimeMilliseconds": 217
}
3
  • Did you bootstrap? Can you check if Sitecore Connection Policy is correct? Commented Jul 21, 2021 at 23:59
  • @YassineAlahyane yes, I've tried running Bootstrap and that returns a successful result. How do I check if the Sitecore Connection Policy is correct? Commented Jul 22, 2021 at 0:02
  • You can call Get Environment from Postman and look for SitecoreConnectionPolicy in the réponse. Check if the URL, username and password are correct Commented Jul 22, 2021 at 12:59

2 Answers 2

2

Please check SitecoreConnectionPolicy in "PlugIn.Content.PolicySet-1.0.0.json" file in Commerce Engine Auth folder.

Ensure it is correct. if not then fix it and do bootstrap again.

Most probably this issue is due to incorrect Sitecore Connection Policy.

Also check the same SitecoreConnectionPolicy in Global.json file.

3
  • I'm 99.9% sure my problem is certificate related in some way, nothing has changed in credentials for connecting to Sitecore so I don't see anything which should be changed in either of these files. I presume the only thing which might be changed here would be username/password? Commented Jul 24, 2021 at 22:47
  • Yes correct this could be related to certificate issue. Overall the problem is that commerce engine is not able to connect with Sitecore. Check the Sitecore URL in SitecoreConnectionPolicy. if it is on https then ensure in IIS that your Sitecore instance has https binding and a certificate added on it, thanks. Commented Jul 25, 2021 at 1:48
  • Also check commerce engine log file inside wwwroot\logs folder of commerce engine. You might find some detailed error there. Commented Jul 25, 2021 at 1:50
0

Khushant Dhingra's answer prompted me to check the settings for my Sitecore site.

I have two hostnames: one for master DB and the other for web. The binding/hostname for the web DB (which is what PlugIn.Content.PolicySet-1.0.0.json was referencing) did not have a valid certificate assigned to it. This was evidenced by simply viewing the Sitecore site on the web hostname - which showed a cert error. Once the binding was updated with a valid certificate, the CheckLongRunningCommandStatus command returned a success result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.