We have an app in which we are parsing text and images in a custom form.
A call is made from app.js, passing the contents of the form to a serverless function. This parses the data and creates an MS word document.
Initially, as part of the same serverless function, we would call the FD API to create a new note against a ticket, with the MS Word document as an attachment. However, we were coming up against frequent timeouts so decided to split the process into two:
- Call to serverless function to parse and generate Word doc => call to Render data to return buffer to app.js;
- Call to new serverless function, passing in the buffer, to create note with attachment.
The problem that we are now encountering is that we receive a ‘PayloadTooLargeError’ error on calling RenderData.
What is the maximum payload size for a call to Render data and can anyone suggest a way around this issue (either the payload size or the timeouts)
Welcome to our community! We are glad to have you here.
SMI renderData payload size limit is 100 KB.
To understand the timeout issue clearer,
- What are the NPM libraries being used?
- Apart from generating the MS word document and creating a note to a ticket, is there any other action being done in the same Serverless function? Including all the synchronous operations.
- Is the successful response required from this Serverless function back to the frontend app? Can it be done via a cron job without needing a immediate response?
Thank you for the welcome!
- In terms of the NPM libraries:
- docx is being used to generate the word document;
- unirest is being used to post the new conversation, along with attachment to the ticket;
- memfs is being used to create a readable stream from the buffer
- The exact operations performed are:
- gather the data from the html;
- parse and generate docx;
- create memfs fs instance from the docx buffer;
- call FD api to add note
- We would rather have instance feedback for the end user as they need to be certain that the process has been successful and the note has been added.
Any ideas on how to work around this please?
Posting a workaround in case anyone else encounters this sort of issue.
It seems that the server app times out 2/3 times if it is not called for some time. Once it has succeeded once, all further calls are successful until another gap in usage occurs.
Got round this by implementing a retry in the client side invocation.