We have built a custom functionality where we used call out from aura component the response size is (5.2 MB) which is under limit of 6 MB for synchronous Apex .There after we have parsed the response (Json format) and no error occurred in scratch org . But when we deploy this code component in packaging org with same call out response with same size(5.2 MB) when the same parsing logic execute we get "Heap size " error. is this platform limitation or any technical limitation .
public static returnType methodName(String accountId,String programId){
String tokendll = accessToken;
Http http = new Http();
HttpRequest request = new HttpRequest();
String requestEndPoint = endpoint for API call;
request.setEndpoint(requestEndPoint);
request.setTimeout(120000);
request.setMethod('GET');
request.setHeader(CONTENT_TYPE, APPLICATION_JSON);
request.setHeader(AUTHORIZATION, BEARER + tokendll );
HttpResponse response = http.send(request);
String status = String.valueOf( response.getstatusCode());
Wrapperclass wrapperVal = Wrapperclass.parse(response.getBody()); // from here we are getting “Heap size “
List<Wrapperclass.data> returnValue = new List<Wrapperclass.data>();
if( status == SUCCESS_CODE ) {
returnValue = wrapperVal.data;
}
return returnValue;
}
public class Wrapperclass {
@AuraEnabled
public List<Data> data;
@AuraEnabled
public String message {get; set;}
@AuraEnabled
public Integer statusCode {get; set;}
public class Data {
@AuraEnabled
public String id;
@AuraEnabled
public String name;
@AuraEnabled
public String feild1;
@AuraEnabled
public String field2;
@AuraEnabled
public String field3;
@AuraEnabled
public String field4;
@AuraEnabled
public String mfdate;
@AuraEnabled
public Price lp;
@AuraEnabled
public List<FProducts> Productlist;
}
public class FProducts {
@AuraEnabled
public String id;
@AuraEnabled
public String url;
}
public class Price {
@AuraEnabled
public Double default_Z {get; set;}
@AuraEnabled
public String defaultPercentageOf {get; set;}
@AuraEnabled
public String minPercentageOf {get; set;}
}
public static Wrapperclass parse(String json) {
return (Wrapperclass) System.JSON.deserialize(json, Wrapperclass.class);
}
}