1

I have been trying to create a new Visualforce page with LWC but I am always getting a GACK, maybe I am messing up with something?

I am using Visual Studio Code to implement this, so I have created a new Lightning App:

applications/lwcComponents.app:

<aura:application extends="ltng:outApp" access="global">
    <aura:dependency resource="lightning:button"/>
</aura:application>

applications/lwcComponents.app-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<CustomApplication xmlns="http://soap.sforce.com/2006/04/metadata">
    <defaultLandingTab>standard-home</defaultLandingTab>
    <isNavAutoTempTabsDisabled>false</isNavAutoTempTabsDisabled>
    <isNavPersonalizationDisabled>false</isNavPersonalizationDisabled>
    <label>lwcComponents</label>
</CustomApplication>

And a new Visualforce page:

pages/testButton.page:

<apex:page >
    <apex:includeLightning />
    <div id="lightningvf" />
    <script>
        $Lightning.use("c:lwcComponents", function() {
            $Lightning.createComponent("lightning:button",
                { label : "Press Me!" },
                "lightningvf",
                function(cmp) {
                    console.log("button was created");
                }
            );
        });
    </script>
</apex:page>

pages/testButton.page-meta.xml

<?xml version="1.0" encoding="UTF-8"?>
<ApexPage xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>48.0</apiVersion>
    <availableInTouch>false</availableInTouch>
    <confirmationTokenRequired>false</confirmationTokenRequired>
    <label>developmentStatus</label>
</ApexPage>

When trying to run the Visualforce page in browser, this is what I am getting:

An internal server error has occurred
Error ID: 188429498-1091988 (-1249547377)

As far as I can see in the Chrome Network tab, the problem is the $Lightning.use method is calling an URL which is throwing this error.

Thank you!

1
  • Welcome to SFSE! While there are a few people directly employed by Salesforce here, most of us are customers of Salesforce who are volunteering our knowledge and experience. If you're getting a GACK, chances are that you'll need to go through Salesforce's own Customer Support to get a resolution.
    – Derek F
    Commented Apr 12, 2020 at 13:20

1 Answer 1

0

lwcComponents.app seems to be created in wrong folder. You have created in applications folder with wrong metadata.

You should be creating the lightning app in the aura folder. Create an Aura Application in the aura folder and deploy it to the org.

The other thing is use salesforce developer console.

2
  • You are right Mohith! The folder and metadata were wrong, creating the app in vscode with the SFDX: Create Lightning app command worked fine =)
    – jgmullor
    Commented Apr 13, 2020 at 14:43
  • @jgmullor you might want to mark the answer as answered to assist others! Commented Apr 13, 2020 at 14:47

You must log in to answer this question.

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