function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jason Lee 67Jason Lee 67 

Lightning Out App throwing Javascript parse error.

I noticed that my Lightning Out App in classic SF is no longer working and the console shows a parsing error.
myVF:504 Uncaught SyntaxError: Unexpected token u in JSON at position 14660



I tried reverting to a version that worked from 3 weeks ago, but it seems to still not work..
Here is my VF code.
myVF.page
<apex:page sidebar="false">
<apex:includeLightning />
    <div id="myDivId">
    </div>
    
    <script>
        var myUserContext = "{!$User.UITheme}";
        $Lightning.use("c:LEXComp", function() {
        $Lightning.createComponent(
            "c:LEXContainer",
            {},
            "myDivId",
            function(cmp) {
                console.log('component created');
                console.log(cmp);
            });
        });
     </script>
</apex:page>

The lightning component works fine separately and within the LEX environment, this seems to only be an issue with Lightning Out.
Azhar BeebeejaunAzhar Beebeejaun
Specifying my explicit namespace instead of using c fixed this for me.
<apex:page sidebar="false">

<apex:includeLightning />
  <div id="myDivId">
  </div>
  <script>
      var myUserContext = "{!$User.UITheme}";
      $Lightning.use("<YOUR_NAMESPACE>:LEXComp", function() {
      $Lightning.createComponent(
          "<YOUR_NAMESPACE>:LEXContainer",
          {},
          "myDivId",
          function(cmp) {
              console.log('component created');
              console.log(cmp);
          });
      });
   </script>
</apex:page>
Nick  SnyderNick Snyder
Hey Azhar,

I'm doing some custom code that is working inside of a community that is included in a managed package (and subsequently with a namespace), and believe I'm running into this problem. Have you run into this in that scenario with custom code that is not going into a managed package itself, and hence doesn't have a namespace?

Nick
Azhar BeebeejaunAzhar Beebeejaun
Hey Nick,

Unfortunately, I have not run into any such scenario.
santhosh konchadasanthosh konchada
User-added image

Having this issue consistently , Using similar code i.e calling aura component in VF