[SalesForce] Issue using Lightning Component on a Customer Community Visualforce Page

I recieve the below error when I am trying to call a Custom Lightning Component in a Visualforce page that is used in Communities.

  • Unrecognized Content-Security-Policy directive 'reflected-xss'.
  • logo180.png Failed to load resource: the server responded with a status of 404 (Not Found)
  • CommunityHomePage:1 Uncaught SyntaxError: Unexpected token w in JSON at position 0
    at JSON.parse ()
    at XMLHttpRequest.xhr.onreadystatechange (lightning/lightning.out.delegate.js?v=ZCuyRUYzK_kAf4cKCIeS2A:143)
  • My Component

    <aura:component controller="LeadController" implements="forceCommunity:availableForAllPageTypes">
        <aura:attribute name="theLead" 
            type="Lead" 
            default="{ 'sobjectType': 'Lead',
                       'Rating__c': 2,
                       'Company': '',
                       'FirstName': '',
                       'LastName': '',
                       'Email': '' }"/>
        <form>
    
            <ui:inputText value="{!v.theLead.Company}" label="Company" class="input"/>
            <ui:inputText value="{!v.theLead.FirstName}" label="First" class="input"/>
            <ui:inputText value="{!v.theLead.LastName}" label="Last" class="input" />
            <ui:inputEmail value="{!v.theLead.Email}" label="Email" class="input" />
            <ui:button label="Save" press="{!c.save}"/>
        </form>
    </aura:component>
    

    My Lightning App is

    <aura:application access="GLOBAL" extends="ltng:outApp" implements="forceCommunity:availableForAllPageTypes">
        <aura:dependency resource="c:CommunityChatter"/>
    </aura:application>
    

    My VF Page is

    <apex:page standardController="Lead">
        <apex:includeScript value="{!$Site.BaseUrl}/lightning/lightning.out.js"/>
        <script>
            $Lightning.use("c:MyLightApp", function() {
                $Lightning.createComponent(
                    "c:CommunityChatter",
                    {},
                    "theLead",
                    function(cmp) {
                        console.log("Component created!");
                        console.log(cmp);
                    });
                });
        </script>
    
        <div id="theLead"></div>
    </apex:page>
    

    Best Answer

    Found the Issue, It is just a Permission on the Profile for Lead.

    Related Topic