PayloadTooLargeError: request entity too large - v2.3

Hi,
We are trying to hit API in which we are passing long base 64 encoded string, as a result, it building big payload.
In server.js file, it is failing with the error message - PayloadTooLargeError: request entity too large
Same API and payload was working in v2.2, however, in v2.3 it is failing.

Can you please suggest how to resolve this issue?

Thanks,
Dev

Hi @Dev_Aditya,

Could you share these details to check at our end?

  1. Timestamp of the error that happened
  2. Sample base64 encoded string or its total size for us to test the same

Hi Raviraj,

  1. There is no specific time that it failed. It is happening every time, both in local and server
  2. We are converting attachments in Base64 encoded format. I have attached the sample attachment with this message

@Dev_Aditya We have tested with a string of 100k+ string and it throws the same error on both platform versions (2.2 and 2.3).

Could you share a zip file of the sample attachment that is used in the app?
If the API has other payload attributes along with this attachment string, could you share them as well?

Hi @Raviraj
I have shared the sample attachments and payload, in one to one message to you in your forum inbox

Thanks,
Dev

Thanks, @Dev_Aditya.

We will try to reproduce the error and confirm here.

Hi Raviraj,
we are using axios to encode attachment. I have shared the file in your inbox

Hi @Dev_Aditya,

We have tried a similar approach of sending a base64 string for a remote file got via the axios library and then sending via our Request Method in 2.2 and 2.3.

We have got the same error for trying out the attachments that you have shared in the private thread in both the platform versions 2.2 and 2.3. We haven’t introduced any new request body limit. It was always 100 KB (including some buffer for request metadata).

Since the attachments are dynamically sent. Some attachments might come within 100 KB and some won’t. So, if you have any set of attachments that succeeds in platform version 2.2 and fails in 2.3, please let us know and we can test and confirm with the same attachments.

Summary:

The app used the Axios library to make API with base64-encoded attachments attached to the API request body. When the app is migrated to the request method on platform version 2.3, the payload size limit of 100 KB has hit and this error is faced.

For any API made from Serverless that doesn’t require the StaticIP option, can use any third-party library. So, here, we recommend continuing to use the Axios library as the same has been working previously.

Refer to this guide on how to use Axios with the latest version without ESModule support in the Freshworks apps.

1 Like

This topic was automatically closed 6 days after the last reply. New replies are no longer allowed.