5

I have an @AuraEnabled method in my APEX controller that have a lot of parameters:

  @AuraEnabled
  public static String sendEmail(
    String    toAddresses,
    String    ccAddresses,
    String    bccAddresses,
    String    fromAddress,
    String    subject,
    String    content,
    String    attachments,
    String    externalAttachments,
    String    staticFiles,
    String    dynamicFiles
  ) {} 

where externalAttachments is an array of objects (serialized) like this: [{ type: '', name: '', data: /*base64 data*/ '' }]

const payload = {
    fromAddress: '',
    toAddresses: JSON.stringify([]),
    ccAddresses: JSON.stringify([]),
    bccAddresses: JSON.stringify({}),
    subject: subject,
    content: contentEml,
    attachments: JSON.stringify([]),
    externalAttachments: JSON.stringify(filesCust),
    staticFiles: JSON.stringify([]),
    dynamicFiles: JSON.stringify([])
};

I used to work this way but since today, when there is a externalAttachment, the action (in JS controller) is fired and the callback is always called with a state of error but the server never received a request (in my logs).

Is there (until ?) a size limit, in byte, for the Lightning Controller <-> APEX Controller payload ?

2
  • Have you tried sending a very small attachment - just 1-2KB? Commented Feb 9, 2017 at 17:39
  • It works with a total of 1.2k ( multiple files) but last week I was able to send multiple 1.2mo files
    – Simonp
    Commented Feb 10, 2017 at 5:36

2 Answers 2

2

Whatever limit there is or isn't between the client and server, within the server Apex method the normal governor limits apply. So if your @AuraEnabled method is receiving several megabytes of base64 data and then tries to turn that data into a different format and so consume more big chunks of heap you will be at risk of hitting the 6M byte heap limit.

2
  • The thing is that the apex method is never reached..
    – Simonp
    Commented Feb 10, 2017 at 5:37
  • @SimonPlacentino OK - an earlier limit. (There is the 6M HTTP request/response limit documented.) Might be worth using your browser's Developer Tools to examine the size of the request posted and experimenting to see what the threshold is.
    – Keith C
    Commented Feb 10, 2017 at 9:37
1

If you are still looking for an answer: The request payload includes all of the actions and their data serialized into JSON. The request payload limit is 4 MB.

Reference - [1]: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_actions_call.htm#!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .