+ Start a Discussion

LC4VF, Summer 2016: The $Lightning.use function works in Developer Org but gets 500 Error in Sandbox

(I also posted this to this forum.)

How do I eliminate or work around a 500 error preventing me from using Lightning components on a VisualForce page in a sandbox? Identical code works in a dev org but fails in a sandbox.

Note: In the sandbox I used, the "My Domain" feature is in a "Ready for Testing but Hidden from Users" state, whereas in the dev org I used, the "My Domain" feature is in a fully deployed state.

Only mentioning My Domain for good measure, since this document:

Finally, you don’t need to enable My Domain to use Lightning
components in the following contexts.
  •  Lightning components with Communities in Community Builder
  •  Lightning Components for Visualforce
Copious details below.

Sample code taken verbatim from Lightning Components Developer Guide.

<aura:application access="GLOBAL" extends="ltng:outApp"> 
    <aura:dependency resource="ui:button"/>
<apex:page >
    <apex:includeLightning />

    <div id="lightning" />

        $Lightning.use("c:lcvfTest", function() {
          { label : "Press Me!" },
          function(cmp) {
            // do some stuff
Dev org succeeded but Sandbox failed.

Dev Org
Renders a button, just as described in the documentation.

Sandbox Org
No Button is rendered. The browser's debug console reveals a request which fails with a 500 error. 

(Note: In the following output, hash-like values were replaced with fictitious ones, since I do not know whether the hashes contain private information. Domain and sandbox names are also fictitious.)

The URL of the request which triggered a 500 error was:

Opening this URL in its own browser tab yields the following content (indentation added by me):
    "event": {
        "eventDef": {
            "v": {
                "superDef": {
                    "v": {
    "defaultHandler":"function() {$A.clientService.setOutdated()}"
The large URL-encoded portion of the URL above decodes to this (indentation added by me):

NagendraNagendra (Salesforce Developers) 
Hi quietopus,

Error seems to originate from
} else if (!currentCC.compiling) {
,although this is indeed the ClientOutOfSyncException being thrown. If you follow the code correctly, it may have something to do with the MasterDefRegistryImpl having the wrong uid for the APPLICATION.

Best Regards,