I've recently had an issue that commerce components were missing in SXA Toolbox. I setup Sitecore Commerce on top of an existing instance and I already had a SXA website working on it. The idea was to add commerce components and functionality to my existing website.
But after commerce setup, the toolbox was still showing default SXA components and commerce components were missing although I add commerce tenant and website modules:
I checked Available Renderings under Presentation folder, there was no problem, commerce renderings were there. I created another tenant and website to see if it shows the commerce components in toolbox. Nothing seemed different but I was seeing commerce components for new website and it was missing on existing one.
Then, I noticed two things:
1- Selected catalog was empty in content editor (/sitecore/Commerce/Catalog Management/Catalogs) even if I see Habitat_Master catalog in Merchandising section on commerce management panel.
2- Bootstrap request in Postman was giving 500 Internal Server Error.
I checked the logs on Authoring server and I saw this error:
16 09:53:57 ERROR Connection id ""0HLL8B6A07B7H"", Request id ""0HLL8B6A07B7H:00000001"": An unhandled exception was thrown by the application.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery header value "X-XSRF-TOKEN" is not present.
at Microsoft.AspNetCore.Antiforgery.Internal.DefaultAntiforgery.<ValidateRequestAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
I needed to check two things:
1- SSL certificate verification should be OFF in Postman (File > Settings). It was already configured correctly on my case.
2- "AntiForgeryEnabled" should be "false" in config.json file (C:\inetpub\wwwroot\CommerceAuthoring_local\wwwroot)
3- Recycle Authoring app pool from IIS
After I did these steps, bootstrap request worked properly.
This steps also fixed the issues I saw in content editor and experience editor. I was able to see Habitat_Master in Selected Catalogs.
And I saw commerce components in toolbox:
But after commerce setup, the toolbox was still showing default SXA components and commerce components were missing although I add commerce tenant and website modules:
I checked Available Renderings under Presentation folder, there was no problem, commerce renderings were there. I created another tenant and website to see if it shows the commerce components in toolbox. Nothing seemed different but I was seeing commerce components for new website and it was missing on existing one.
Then, I noticed two things:
1- Selected catalog was empty in content editor (/sitecore/Commerce/Catalog Management/Catalogs) even if I see Habitat_Master catalog in Merchandising section on commerce management panel.
2- Bootstrap request in Postman was giving 500 Internal Server Error.
I checked the logs on Authoring server and I saw this error:
16 09:53:57 ERROR Connection id ""0HLL8B6A07B7H"", Request id ""0HLL8B6A07B7H:00000001"": An unhandled exception was thrown by the application.
Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The required antiforgery header value "X-XSRF-TOKEN" is not present.
at Microsoft.AspNetCore.Antiforgery.Internal.DefaultAntiforgery.<ValidateRequestAsync>d__9.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
I needed to check two things:
1- SSL certificate verification should be OFF in Postman (File > Settings). It was already configured correctly on my case.
2- "AntiForgeryEnabled" should be "false" in config.json file (C:\inetpub\wwwroot\CommerceAuthoring_local\wwwroot)
3- Recycle Authoring app pool from IIS
After I did these steps, bootstrap request worked properly.
This steps also fixed the issues I saw in content editor and experience editor. I was able to see Habitat_Master in Selected Catalogs.
And I saw commerce components in toolbox:
hello,
ReplyDeletei'm facing the same issue, after installing the sitecore commerce (Sitecore.Commerce.2018.12-2.4.63), i didn't see the commerce components. commerce renderings available in the presentation folder.
i don't have the authoring error. i still updated the config.json. after recycle the pool, i didn't see the commerce component.
any suggestion?
Can you please help me to run the postman script.
ReplyDeleteHi,
DeleteWhat response you get when you run "Bootstrap()" request?
I was getting 500 internal error and after changing "AntiForgeryEnabled" configuration I started to get 200 success response.
i'm unable to run the bootstrap() request? what url i pass in postman? what are are the values for OpsApIHost and OpsApi?
ReplyDeletein content editor, under /sitecore/Commerce/Catalog Management/Catalogs, i can see the habitat_master in the selected catalog. see below screenshot.
ReplyDeletehttps://www.screencast.com/t/hPwBrbgS
when i tried to create a site, i only see the following module for languages, other commerce module are not showing.
https://www.screencast.com/t/bZAgTYdB
I wrote down the steps in an another post.
DeleteHope it helps:
https://dogabenli.blogspot.com/2019/04/sitecore-commerce-xc9-tips-configuring.html