Santa

Let’s Talk

We would love to hear from you. Want to know more about
our services or have any questions? Say Hi!

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

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

We have identified an issue with XM Cloud pages where the editing environment (EE) and pages.io are not communicating correctly with the rendering host. Under normal circumstances, the rendering host retrieves data from XM Cloud pages to display the content and structure. However, in this specific case, the amount of data being transferred exceeds the 2MB limit imposed by the rendering host, resulting in an error.

What to do if you encounter this error:

The information below outlines the steps to take if you encounter this error within pages.io and the editing environment (EE).

xmcloud-page-io-error-img
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
  1. data[key].ts

    xmcloud-page-io-error-img
  2. Render.ts

    xmcloud-page-io-error-img

    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.

    xmcloud-page-io-error-img

    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

Mitesh Patel - Technical Head

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.


YOU MAY ALSO LIKE