Opening Lightning Application which refers to SObject for which current running user doesn't have permission raises internal server error with Gack Id -227057212
Steps to reproduce:
Create custom object Custom_Object__c
Create Apex Class
public class PILexCont { @AuraEnabled public static Custom_Object__c performBusinessLogic( ){ Custom_Object__c record = new Custom_Object__c(); insert record; return record; } }
Create an App
<aura:application controller="PILexCont"> <aura:attribute name="record" type="Custom_Object__c"/> <button onclick="{!c.performLogic}">Perform business logic</button> </aura:application>
With Javascript Controller
({ performLogic : function(component, event, helper) { var action = component.get( "c.performBusinessLogic" ); action.setCallback(this, function(response ) { var state = response.getState(); if (component.isValid() && state === "SUCCESS") { /* component.isValid() simply, checks if the component has been destroyed or not. (http://salesforce.stackexchange.com/questions/81998/what-does-the-lightning-component-method-component-isvalid-do) */ alert('component valid, state success'); var record = response.getReturnValue(); component.set("v.record", record ); } else { alert('error?' ); } }); $A.enqueueAction(action); } })
Open an app by a user who doesn't have permission to Custom_Object__c
- Obtain the error
An internal server error has occurred
Error ID: 1557802061-15979 (-227057212)