4

Whenever i tried to trigger InitializeEnvironment Postman script..

{{OpsApiHost}}/{{OpsApi}}/InitializeEnvironment(environment='{{Environment}}')

I always get below as a response.

{
    "@odata.context": "https://localhost:5000/CommerceOps/$metadata#Commands/$entity",
    "Id": "7d681424004f4c80850d0c4e19352eeb",
    "ResponseCode": "Ok",
    "Messages": [],
    "Models": [],
    "ActionUrl": "",
    "TaskId": 446547,
    "Status": "WaitingForActivation",
    "IsFaulted": false,
    "IsCompleted": false,
    "IsCanceled": false
}

And i think, that is the reason why my environment is not properly initialized.

Update 1: Added logs

18 19:31:09 INFO Request starting HTTP/1.1 GET http://localhost:5000/commerceops/InitializeEnvironment(environment='ArvindAuthoring') 18 19:31:09 INFO Successfully validated the token. 18 19:31:09 INFO AuthenticationScheme: "BearerIdentityServerAuthenticationJwt" was successfully authenticated. 18 19:31:09 INFO AuthenticationScheme: "Bearer" was successfully authenticated. 18 19:31:09 INFO Authorization was successful for user: "sitecore\Admin". 13 19:31:09 INFO Executing action method "Sitecore.Commerce.Core.CommandsController.InitializeEnvironment (Sitecore.Commerce.Core)" with arguments (["ArvindAuthoring"]) - ModelState is Valid 13 19:31:09 INFO Executing ObjectResult, writing value "Microsoft.AspNetCore.Mvc.ControllerContext". 13 19:31:09 INFO Executed action "Sitecore.Commerce.Core.CommandsController.InitializeEnvironment (Sitecore.Commerce.Core)" in 13.4489ms 13 19:31:09 INFO Request finished in 33.8218ms 200 application/json; odata.metadata=minimal; odata.streaming=true; charset=utf-8 28 19:31:09 INFO Management.block.ValidateSitecoreConnection: Validating Sitecore connection: Url=https://storefront.local, Environment=ArvindAuthoring. 28 19:31:09 INFO SQL:blocks:ValidateSqlConnection: Validating Entity Store SQL connection: Environment=ArvindAuthoring 13 19:31:10 INFO Pricing.block.InitializeEnvironmentDefaultPriceBookBlock.InitializingArtifactSet: ArtifactSet=Pricing.DefaultPriceBook-1.0 28 19:31:10 WARN CtxMsg.ValidationError.BookNameAlreadyInUse: Text=Book name DefaultPriceBook is already in use.|Shopper=|Shop=|Correlation=924d5a55e5e747ada5bcac7ebdcd4d7c 26 19:31:10 INFO Management.GetCommerceTerms./sitecore/Commerce/Commerce Control Panel/Commerce Engine Settings/Commerce Terms/System Messages|en 13 19:31:10 INFO Management.block.getitemsbypath./sitecore/Commerce/Commerce Control Panel/Commerce Engine Settings/Commerce Terms/System Messages|en 13 19:31:13 ERROR PipelineAbort:Book name DefaultPriceBook is already in use. 13 19:31:13 ERROR Pricing.block.InitializeEnvironmentDefaultPriceBookBlock.Error: Message=The price book can not be null.

Any clue?

1
  • can you add to your question logs from engine server? Commented Jul 9, 2018 at 12:24

2 Answers 2

4

You need to run the CleanEnvironment command first. You cannot run the InitializeEnvironment twice without running the CleanEnvironment command, because it will try to import the same entities.

1

InitializeEnvironment is a long operation. As you can see in the response IsCompleted is false. In the commerce Postman collection, you can find the request "Check Long Running Command Status" which you can execute to check the InitializeEnvironment status.

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.