1

on salesforce side done this work

1) CORS Whitelist Origin set to https://*.herokuapp.com.

2) on sandbox created App dxTest2App

  <aura:application access="GLOBAL" extends="ltng:outApp" >
    <c:dxTest2 />   
 </aura:application> 

created Component dxTest2 

 <aura:component access="GLOBAL">
            Hello
 </aura:component>

On origin Server node js side done this work i have passed oauth.access_token after authentication in index.js file of nodejs. In Index.hjs work to load Lightning app is done.

• for this purpose i have included • created script

  The function setupLightning() is called in index.hjs is created in app.js .All needed code for loading done in this.

index.hjs is:

<!DOCTYPE html>
<html>
  <head>
   <title>TouchCR</title>   
   <script src="/socket.io/socket.io.js"></script>
   <script type="text/javascript">   
    </script>
  </head>
  <body onload="setupLightning();">
  <form>
    <input name="Token" Id="Token" type="hidden" value="{{oauth.access_token}}"/>

  <div id="messages" style="background: lightblue; height: 400px; width: 400px;></div>
     <div id="future"></div>
    <script src="XXXXXXmy.salesforce.com/lightning/lightning.out.js"></script>
    <script src="./javascripts/app.js"></script>
    </form>
  </body>  
</html>

app.js code is :-

function setupLightning() {

    var oauth_token = document.getElementById('Token').value;   
    var url   = 'https://mcnabb--devsanbox.lightning.force.com';

    $Lightning.use("c:dxTest2App", function() {

         $Lightning.createComponent("c:dxTest2",
         { label : " Comp" },
         "lightning");
       }, url, oauth_token);    
}

Here is code for loading App in function setupLightning.but i have got this warning while loading component.

WARNING: Callback failed: aura://ComponentController/ACTION$getApplication

  • Any resolution on this even am getting error WARNING: Callback failed: aura://ComponentController/ACTION$getApplication – Raj_SFDC Aug 1 '16 at 17:20
  • Usually when they are completely and totally vague like this it's some form of bad syntax and lightning gives the horribly vague message. What I do is examine the most recently edited code for syntax problems. I've gotten this when i used a : instead of a ; to terminate a line of code. and many other syntax errors. Another thing I do is in recently edited code put a system.log('made it here'); message and check the console log. then move it a couple lines down and do it again. when the message no longer appears in the console log you no know what lines of code it doesn't like – Ohmicron Aug 8 '16 at 12:39
0

You have to add aura:dependency to both App and Component.

  • Please also show how to add it to the code as well as putting in the short answer - see How to Answer. Thanks. – Dave Humm Nov 4 '16 at 9:51

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.