3

I have a visualforce page which contains a lightning component, like so:

<apex:page sidebar="false">
    <apex:includeLightning />
    <script>
    $Lightning.use("c:My_App", function() {
        $Lightning.createComponent("c:My_Wrapper", 
                                   {"accId":"{!$CurrentPage.parameters.id}"}, 
                                   "tmp-id", 
                                   function(cmp) {
                                       //
                                   });
    });
    </script>
    <body>
        <div>
            <div id="tmp-id" />
        </div>
    </body>
</apex:page>

c:My_App uses extends="ltng:outApp":

<aura:application access="GLOBAL" extends="ltng:outApp" >
    <aura:dependency resource="c:My_Wrapper" />
    <aura:dependency resource="c:My_OtherWrapper" />
</aura:application>

Within the lightning component c:My_Wrapper, many calls to an apex controller are made, which does a lot of heavy lifting for the initialization of this component. As a System Administrator, this works fine. However, in another profile, these apex calls are never made.

Debug logs

The lines blocked in red can be ignored; those are unrelated. The page load happens at the lines marked with green. The apex calls are show marked with blue. As you can see, when I am a System Admin (I am the big blue rectangle, of course), these apex calls are made. As a user in the Retail profile, they are not. When this failure occurs, no apex logs or console logs are made, and the only feedback Salesforce provides is:

An internal server error has occurred
Error ID: 1478192347-59189 (-993347769)

I suspect this has something to do with access/permission for Lightning, but I don't know what permission or setting needs adjusted to fix this issue. Please point me in the right direction.

UPDATE: I have attempted several steps, one at a time, in an attempt to hit the issue with scatter-shot. None of them fixed the issue. These include:

  • Giving the user Apex access to the controllers.
  • Setting the controllers to without sharing.
  • Giving the user the 'Lightning Experience User' permission and setting them up as a Lightning user

The next step I'd like to take is to try granting the 'Lightning Console User' permission, but it's grayed out and I can't seem to find the prerequisite for it.

It's also worth noting that, despite the fact that there is a console.log in the first line of the init of c:My_Wrapper, no logs are sent to console when the Retail User attempts to use this page. It seems to me that the lightning app and component are never created for this user.

SECOND UPDATE: I've created a case with Salesforce around this issue. Hopefully I'll be able to answer this question myself, if they can help me find the problem.

  • 3
    Did you give that profile access to the class? (Setup > Develop > Apex Classes > ClassName > Security Settings, or Setup > Manage Users > Profiles > ProfileName > Enabled Apex Classes) – sfdcfox Jul 11 '18 at 17:26
  • @sfdcfox Unfortunately, after granting the profile in question 'Apex Class Access' to the necessary classes, I'm getting the same results. – iwhitt567 Jul 11 '18 at 17:45
  • Well, that was my first thought, I'm kind of sad it didn't work. You might need to actually open a case for this one, unless I can find someone that can tell me what the gack means. – sfdcfox Jul 11 '18 at 17:54
  • Does that profile has API access ? – Pranay Jaiswal Jul 11 '18 at 18:16
  • @PranayJaiswal Giving 'API Enabled' to the user in question did not solve this problem. – iwhitt567 Jul 11 '18 at 18:25
0

I opened a case with Salesforce and they were able to help me faind the cause of my issue. The good news is, it was an easy fix. The bad news is, it's pretty obvious in retrospect.

Deep within my wrapper lies a component from an unmanaged package, which uses several custom objects contained within that package. 'Read' permissions had to be given to those custom objects in order to fix this issue.

So there was nothing wrong with Lightning, and this is definitely something I could have avoided if I had thought of the object permissions to those, but it didn't cross my mind. It's unfortunate that the error messaging isn't able to communicate this, but I'll take this as a learning opportunity.

Thanks to all who responded.

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.