6

When i am previewing the Lightning APP it is giving error

Something has gone wrong. $Lightning is not defined. Please try again.

Mainly this is happening after salesforce update. Is there anything to do with that ?

<aura:application access="GLOBAL" extends="ltng:outApp">
   <c:load filesInSeries="/resource/CommunityStore/jquery-1.11.2.min.js,/resource/CommunityStore/bootstrap/bootstrap.js,/resource/CommunityStore/bootstrap/bootstrap.css,/resource/CommunityStore/style.css"/>  
    <aura:dependency resource="c:AccountInfoComponent"/> 
</aura:application> 

VFPAGE:

<apex:page standardStylesheets="false" sidebar="false">

    <div style="vertical-align: top; margin-top: -650px;">
        <apex:includeLightning />
        <div id="lightning" />

        <script>

        $Lightning.use("c:AccApp", function() {
          $Lightning.createComponent("c:AccountInfoComponent",
          { Label : " " },
          "lightning",
          function(cmp) {
            // do some stuff
          });
        });
    </script>
    </div>


</apex:page>
6
  • not completely sure but I am guessing issue with your org domain.. You need to setup your org domain in order to use Lightning features. not sure just create domain and try once again
    – Ratan Paul
    Jan 11, 2016 at 15:51
  • Already created domain for my org. Jan 11, 2016 at 16:00
  • Can you add your visualforce page to your question?
    – Jenny B
    Jan 11, 2016 at 17:23
  • @JennyB added VF page Jan 11, 2016 at 17:59
  • What if you try moving the apex:includeLightning above the div?
    – Jenny B
    Jan 11, 2016 at 19:28

2 Answers 2

5

There is a good chance that an out of date version of lightning.out.js is being cached by your browser or a network proxy. This issue is already being worked on. As a temporary workaround can you try changing:

<apex:includeLightning/>

to:

<apex:includeScript value="{!$Site.BaseUrl}/lightning/lightning.out.js?v=2"/>

and let me know if that fixes the issue for you?

9
  • I tried the above code you mentioned I am facing the same issue Jan 11, 2016 at 20:37
  • 1
    Are you using LC4VF in a Community or Site? If yes, can you try accessing the VF page in question directly - not through the community domain? We're seeing very different proxy server response headers depending on if you access /lightning/lightning.out.js from the VF domain, the Lightning domain, and I suspect VF via the Community domain is where we have an issue (too aggressive squid proxy caching). Jan 11, 2016 at 22:05
  • I am using that in Communities and adding community domain to access that page. If I don't add community domain it is displaying empty list Jan 11, 2016 at 22:18
  • Displaying an empty list === the component runs correctly but just not have any data in it? Is the list's values coming from an Apex controller? There is a case being investigated by one of my team mates right now that has to do with lists not being returned correctly from apex controllers. Jan 11, 2016 at 22:52
  • Yes the list values are coming from Apex controller. Jan 11, 2016 at 23:28
0

Are you trying to use Lightning Out (I see your app extends ltng:outApp)? I'd does not make sense to have anything in an LO app's body other than aura:dependency tags since its sole purpose is to provide metadata about the component(s) you want to use with $Lightning.createComponent() in a non Lightning container integration scenario.

Also having an application implement force:appHostable is nonsensical. That marker interface is only useful for components and will not allow an app to be used as a lightning component tab's target.

It looks like you're mixing a number of metaphors and I'd recommend taking a step back and go through trailhead/docs again.

2
  • 1
    thanks for the reply I am using extends="ltng:outApp" because I am using component in VF page and I removed implements="force:appHostable" but it is giving same error. Jan 11, 2016 at 16:23
  • For LC4VF/LO you should not use the .app to load other javascript or css - either move those includes (the ones behind c:load) into the VF host page or use ltng:require to load them in your component that needs them. What does c:load look like? Does it use ltng:require? Jan 11, 2016 at 20:06

You must log in to answer this question.

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