4

I have added a Lightning component to a VF page and the lightning component is displaying fine when I access the VF page. But If I set this VF page as the community home page and try to access this without any authentication then the page fails to load the Lightning component. If I were to access the community with authentication then it works fine.

Any ideas on how to get this working?

Lightning component:

<aura:component implements="forceCommunity:availableForAllPageTypes" access="GLOBAL" >
    This is a component
</aura:component>

Lightning App:

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

VF Page:

<apex:page >
    <apex:includeLightning />

  <div id="lightning"/>
  <script >
      //inject the lightning component.
      $Lightning.use("c:communityApp", function() {
          $Lightning.createComponent("c:communityComponent",{},"lightning", function(cmp) {
              console.log('inside the component',cmp);
          });
        });
  </script>
</apex:page>

Error in the browser console:

enter image description here

4
  • Not sure if you should have this in your app: implements="forceCommunity:availableForAllPageTypes" - I thought it was only for components. Try removing it from the app. Commented May 4, 2017 at 1:14
  • I did try it removing from the app as well but that did not resolve the issue.
    – Sam
    Commented May 4, 2017 at 1:16
  • Are you using the Napali template? Commented May 4, 2017 at 1:22
  • No, We are using the apex+ VF community
    – Sam
    Commented May 4, 2017 at 1:31

1 Answer 1

5

I think the interface you are extending is wrong, you need to extend

<aura:application access="GLOBAL" extends="ltng:outApp" 
implements="ltng:allowGuestAccess"> 

Please check the release notes. This feature was added as part of Spring '17.

1
  • Thanks! adding this implements made it possible to view the component viewable on community pages.
    – Sam
    Commented May 4, 2017 at 4:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .