Skip to main content

Posts

Showing posts with the label JSS

Sitecore JSS SDK Middleware Issue with Large Query Parameters

Recently, a fellow Sitecorian connected with me to discuss an interesting performance issue with a Sitecore JSS application running on Next.js and Vercel. The application was working perfectly fine for normal URLs. However, when users accessed the website through marketing or advertising URLs containing multiple query string parameters, the requests started taking significantly longer and eventually failed. The interesting part was that the same page worked perfectly when the query parameters were removed. Let's understand what was happening and how to fix it. The Problem The application was using Sitecore JSS with Next.js and hosted on Vercel. Normal URLs were working as expected: https://www.example.com/ Even URLs with a few query parameters were working: https://www.example.com/?p1=1&p2=2&p3=3&p4=4&p5=5 But when the number of query parameters increased, the request started taking much longer and eventually failed. In some cases, we were seeing errors such as: 504...

SSC API key is required. Pass with 'sc_apikey' query string or HTTP header error in Sitecore GraphQL Playground

 The Problem A friend of mine is working on upgrading Sitecore 9.3 to Sitecore 10.3.1. They are also upgrading to JSS 21.1 module. They wanted to ensure that all our GraphQL api endpoints keep functioning without breaking. When they opened GraphQL playground to test apis, they got the below errors -  SSC API key is required. Pass with 'sc_apikey' query string or HTTP header. Server cannot be reached Below is the snapshot of same -  We connected to solve their problem. The Solution We found that in JSS 16, when we supplied sc_apikey in page URL, it was passed on to GraphQL URL properly. But in JSS 21, which uses newer version of GraphQL, the sc_apikey in page URL query in browser was stripped off as in the snapshot above. To fix it, either you can manually specify the sc_key in the URL section in GraphQL playground or you can set the headers for sc_apikey in JSS 21.1. Check below snapshot for this - Hope it helps you!!

Auto Install Sitecore Modules in Azure PaaS using ARM templates

We can install the Sitecore modules e.g. JSS, SXA, SPE or any other module using Azure ARM templates while installing a new Sitecore environment in Azure PaaS. Wondering why we need to do this? To setup a Sitecore application server by single click using CICD, we cannot depend on manual installation of Sitecore modules as a post-installation step after Sitecore setup. How we do this? We need to- Download the wdp file (not zip package) for JSS module and store it in Azure storage (wdp available at -  https://dev.sitecore.net/Downloads/Sitecore_JavaScript_Services/120/Sitecore_JavaScript_Services_1200.aspx ) Add a snippet with JSS module details in azure.parameters.json (described in the links below) https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates/blob/master/MODULES.md https://github.com/Sitecore/Sitecore-Azure-Quickstart-Templates/tree/master/JSS%2012.0.0/xp Prerequisite   - Bootloader module snippet need to be included in azure.parameters.json as well for this...