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 || Chief Technology Officer (CTO) | ADDACT
Sitecore AI Certified || XMCloud || OrderCloud Certified
Mitesh Patel is the Chief Technology Officer (CTO) at Addact with 12+ years of experience in enterprise CMS, digital experience platforms, and cloud-native application development. He specializes in Sitecore, Contentful, Strapi, Kentico, Umbraco, Contentstack, and .NET, helping organizations build scalable, secure, and future-ready digital solutions through modern CMS, headless architectures, AI-driven experiences, and cloud technologies.