I’m honoured to be invited as #Shehacks2018 mentor by Microsoft for supporting the local woman IT community. It’s a great community with all talent people from different industries. It’s my first time join the community as mentor. Not just sharing my experience and giving guidance, but also I learnt a lot from them during the 1.5 day event. As part of the them, we came up with solution for a real issue by leveraging Machine Learn and cognitive services. Our machine Learn and AI solution ultimately won the 3rd party integration with Machine Learning and AI Award! . Thanks AWS for the rewards.
Today I came across a publishing issue in our UAT environment. After I clicked the publish, the publish popup window doesn’t display and in the console log it is showing an error “because it set multiple X-Frame-Options” headers with conflicting values (‘SAMEORIGIN, Allow-From’…) Falling back to ‘deny’.” as shown below.
So, I checked the web.config file and noticed that someone added “ALLOW-FORM” X-Frame-Option in web.config.
The error is because from sitecore 8.1 update 3 onwards sitecore introduce default module to add X-FRAME-OPTION Sameorigin using below module
<add type="Sitecore.Web.XFrameOptionsHeaderModule, Sitecore.Kernel" name="SitecoreXFrameOptionsHeaderModule" />
Recently, I’ve been working on Sitecore commerce project. In the post below, I’m going to share the experience about how I troubleshoot the issue and get it solved eventually.
The issue I encountered in creating a commerce user. customerServiceProvider “createUser” throws an exception
“An element with the specified key already exists.”, however the commerce user and sitecore user were successfully created. So WHY?
The initial suspicion was there are some duplications in the database. so I double checked UserObject table, the Addresses table (because I also add billing address and shipping address for the user), as well as the aspnet_Users table in Core database. Unfortunately they all looks clean and right, no duplications.
Then I thought that maybe there are some other tables gets updated while creating a new user, so I opened the “SQL Server Profiler” tool trying to track all the database queries. NO luck.
Ultimately, I found the issue. it was because when delete a user in Sitecore, it does delete both commerce user and Sitecore user, BUT not contacts in xDB. Just for the proof of concept, I removed the contact and identifier from xDB. Bingo! It fixed the issue.
Today while doing self-testing, I found that OTB facet filter component doesn't work as expected. After digging into the code, it is surely a Sitecore SXA bug. Therefore, I decided to share this and hope this can help you to understand the issue and quickly solve it.
What’s the issue?
The screenshot below, it has 3 properties, and I assigned different property type for each of them (for testing purpose). The expected result would be Apartment(1), House and Land(1) and Townhouse (1). However, it is indicating (2) items per type? Why?!
My first question was that is this because of multi-languages? After looking into the code, I found the answer, it’s because the facet component ONLY takes the search scope as its search criteria, which means the results contains multiple items with different language.
Here is the screenshot for the index, As you can see It has two items with the lottype equals to “House and Land”, one is Chinese version and the other is English version. That’s why the facet indicates (2) items per type in the example above. This bug could cause the discrepancy between search results and facet filtering, if you are implementing multi-language website.
Fortunately, This bug has been fixed in SXA 1.6, for all previous version please create a ticket in support portal for requesting the patch for your SXA version.
Creating a static 500 error page is not something new. SXA provides this feature out of the box. However, when the first time seeing the settings in SXA, I was thinking why SXA 500 page is configured in CMS. 500 error could be caused by an server error, or database error which means CMS may not be accessible. Why? Today, one of the colleagues asked me the same question, and
Unfortunately, Rare information can be found on the Sitecore documentation site. After spending an hour looking into the code, we totally understand how it was designed.
Here are the steps to make 500 error page working in SXA:
- Configure the Server Error Page – Linking to error page item
- Select the “Site Definition” item
- Once you click on the Site definition item, the “Error handling” menu will appear in the ribbon
- Click on “Generate static error page” button (as shown above)
- It will popup an confirmation dialog
- Click “Ok” then going to the root of your website in which you can find “ErrorPages”, and the static error page is automatically generated in this folder.
When an error occurs, user will be redirected to this static error page. This magic can be found the ErrorHandling pipelines.
Overall, I will say it is well designed, although there is a bit of flaw in the above code - it doesn’t handle the response status. The Server.TransferRequests does not change the status code, it passes control of the request on to another page without telling the client. However you can always manually set the status code to 500 by overriding the flaw Process method.