Content Insights Tip #61 | Resolving the 2MB Body Limit Issue in Sitecore XM Cloud Experience Editor

 

Content Insights Logo

Today, I encountered an issue while using the Experience Editor in Sitecore XM Cloud. We exceeded the 2MB body limit on a specific page, which caused the Experience Editor to throw the following error:

Connection to your rendering host https://xmcloud-instance/api/editing/render failed with the following error: The remote server returned an error: (413) Body exceeded 2mb limit.

Fortunately, there is a workaround for this problem. You can increase the maximum body size of the Editing host by configuring the render.ts file. Here's how you can do it:

  1. Locate the render.ts file in your SXA Starter, you can find it at:
    packages/create-sitecore-jss/src/templates/nextjs/src/pages/api/editing/render.ts

    Body size configuration

  2. Modify the body size limit configuration in this file.
For the complete file, you can refer to the GitHub repository.

By following these steps, you can bypass the body size limit issue and continue using the Experience Editor, though it's best to consider the long-term recommendation from Sitecore.

Important note: Sitecore advises against using the Experience Editor in XM Cloud due to its high resource consumption, which can affect system performance for other users. It would recommend disabling the Experience Editor for now and wait for Sitecore to fully remove it from XM Cloud.

Until next time!