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 ?

  • Have you tried sending a very small attachment - just 1-2KB? – Caspar Harmer Feb 9 '17 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 – Simon Placentino Feb 10 '17 at 5:36
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.

  • The thing is that the apex method is never reached.. – Simon Placentino Feb 10 '17 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 Feb 10 '17 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.