You need to sign in to do that
Don't have an account?
Michal Kozak
Internal Salesforce.com Error for @auraEnabled integer operation
Hi, I tried to report this bug to salesforce, but was redirected here.
This is very likely internal salesforce issue.
When you try to do any operation with integer received from lightning component (@AuraEnabled), you got
FATAL_ERROR|Internal Salesforce.com Error
Full log included:
Note that system.debug('pageNumber: ' + pageNumber); works. But all other integer operations fail.
Please advise how to circumvent this issue.
This is very likely internal salesforce issue.
When you try to do any operation with integer received from lightning component (@AuraEnabled), you got
FATAL_ERROR|Internal Salesforce.com Error
public with sharing class TestController2 { @AuraEnabled public static integer getTestResult(integer pageNumber) { return pageNumber + 1; } }
Full log included:
34.0 APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;SYSTEM,DEBUG;VALIDATION,INFO;VISUALFORCE,INFO;WORKFLOW,INFO 23:30:39.143 (143052245)|EXECUTION_STARTED 23:30:39.143 (143081946)|CODE_UNIT_STARTED|[EXTERNAL]|01pU0000001YzfB|TestController2.getTestResult 23:30:39.143 (143501666)|METHOD_ENTRY|[1]|01pU0000001YzfB|TestController2.TestController2() 23:30:39.143 (143599706)|SYSTEM_MODE_ENTER|false 23:30:39.143 (143634027)|SYSTEM_MODE_EXIT|false 23:30:39.143 (143644512)|METHOD_EXIT|[1]|TestController2 23:30:39.144 (144047168)|FATAL_ERROR|Internal Salesforce.com Error 23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE 23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|(default)| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 23:30:39.144 (144066440)|LIMIT_USAGE_FOR_NS|Vendavo| Number of SOQL queries: 0 out of 100 Number of query rows: 0 out of 50000 Number of SOSL queries: 0 out of 20 Number of DML statements: 0 out of 150 Number of DML rows: 0 out of 10000 Maximum CPU time: 0 out of 10000 Maximum heap size: 0 out of 6000000 Number of callouts: 0 out of 100 Number of Email Invocations: 0 out of 10 Number of future calls: 0 out of 50 Number of queueable jobs added to the queue: 0 out of 50 Number of Mobile Apex push calls: 0 out of 10 23:30:39.144 (144066440)|CUMULATIVE_LIMIT_USAGE_END 23:30:39.144 (144134140)|CODE_UNIT_FINISHED|TestController2.getTestResult 23:30:39.147 (147174875)|EXECUTION_FINISHED
Note that system.debug('pageNumber: ' + pageNumber); works. But all other integer operations fail.
Please advise how to circumvent this issue.
change the parameter to string and convert its value in the code.
All Answers
change the parameter to string and convert its value in the code.
If @AuraEnabled methods don't support Long or Integer parameters then that should be flagged in the editor and not allow you to save. If it is allowed then the correct conversion should be done before enter the method.
By the way, an alternative solution to changing the type to string, is to change it to Decimal. At least that way the calling code can maintain the belief that it's somewhat numeric related.
By the way, this is a ridiculous problem and pretty astonishing for a 25,000 employee company to leave it unfixed for so long. And what the heck is up with type checking in Apex?! Are you running on PHP?
{
"pageNumber" : "1" // send this as string, Then apex controller might generates an error, here in this case
}
{
"pageNumber": 1 // passes value as integer to the controller. So won't get any error.
}
If you have a string value, we can use parseInt() function in JavaScript