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

Lightning App:

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

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);

Error in the browser console:

enter image description here

  • 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. – Caspar Harmer May 4 '17 at 1:14
  • I did try it removing from the app as well but that did not resolve the issue. – Sam May 4 '17 at 1:16
  • Are you using the Napali template? – Caspar Harmer May 4 '17 at 1:22
  • No, We are using the apex+ VF community – Sam May 4 '17 at 1:31

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

<aura:application access="GLOBAL" extends="ltng:outApp" 

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

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

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.