Sitecore JSS rendering site not opening and throws client-side error?

All of a sudden my Sitecore JSS / NextJS rendering page stopped working and starting popping this message:

-----------------------------------------------------------------------------------------------
Error: Request failed with status code 400
Call Stack
createError
node_modules/@sitecore-jss/sitecore-jss-nextjs/node_modules/axios/lib/core/createError.js
-----------------------------------------------------------------------------------------------

After a lot of trial and error spanning nearly two days, I realized that I had to delete the dist folder and npm_modules in the client-side and execute:

npm install
npm run build

I presume this clears any cache or old npm_modules and builds the new dist. So, this is worth giving a try whenever you see the above page and your rendering is not opening!

Then, when I executed up.ps1, my home page appeared fine.

Comments