XMCloud Page.io Error - The remote server returned an error: (413) Body exceed 2MB limit
Published: 21 August 2024

What to do if you encounter this error:

Error Symptoms:
Connection to your rendering host...failed: Indicates a failed connection between XM Cloud and the rendering host.
The remote server returned an error: (413) Body exceeded 2MB limit: This error specifically indicates that the JSON object is too large.
When the JSON object surpasses the maximum size allowed by the rendering host's body parser (typically 2MB), the "(413) Body Exceeded 2MB Limit" error occurs.
Solution:
To resolve this issue,
- Break down content: Divide large content into smaller sections to reduce the JSON object size. Utilize GraphQL queries to minimize the JSON object.
- Content review: Remove unnecessary tags and fields from the page content.
- Technical Solution: To accommodate larger JSON objects, increase the body parser limit in the following Next.js files from 2MB to 5MB. Please follow below steps for resolution in your code repo:
Steps 1: Go to the below path for this file:
- src\sxastarter\src\pages\api\editing\data[key].ts
- src\sxastarter\src\pages\api\editing\render.ts
- data[key].ts
Render.ts
In these 2 files Extend the limit for 2mb to 5mb and then check what happen for this error.
[Key].ts & Render.ts extend the limit for this both files.
By implementing these steps, you can effectively resolve the error, ensuring that both page.io and the editing environment (EE) function properly within XM Cloud.

Mitesh Patel - Technical Head - ADDACT
Sitecore || XMCloud || OrderCloud Certified
Mitesh, a distinguished Technical Head at Addact/Addxp, is a prominent figure in Sitecore/XMCloud/OrderCloud certified writing. From Sitecore XM Cloud Developer Certification to Sitecore 10 .NET Developer Certification and Sitecore OrderCloud Certification, Mitesh's expertise is unparalleled. Mitesh is not only a skilled Sitecore CMS developer but also a 12+ years experienced software engineer proficient in various technologies such as MVC, ASP.Net, C#, jQuery, and Azure cloud/AWS.