[SalesForce] Lightning Web Component on Salesforce’s Public Site

I created a LWC Components and used in Visualforce Pages to make this page Public.

For this I created New domain in my developer edition

SetUp–> Sites, Created a new Domain name called preschool So the domain Name is

preschool-developer-edition.ap16.force.com

And Created a new Site label and added My visual force page in Active Site Home Page, saved and Activated.

Now if i go and preview the private site. It display as below.

enter image description here

The developer console shows an error:

lightning.out.delega…v=1584969017223:126 GET https://preschool-developer-edition.ap16.force.com/c/EnrollmentVf.app?aura.format=JSON&aura.formatAdapter=LIGHTNING_OUT 500 (Internal Server Error)
requestApp  @   lightning.out.delega…v=1584969017223:126
use @   lightning.out.delega…v=1584969017223:140
script.onload   @   lightning.out.js?v=2:46
load (async)        
loadDelegateScript  @   lightning.out.js?v=2:43
(anonymous) @   lightning.out.js?v=2:53
(anonymous) @   lightning.out.js?v=2:78

Best Answer

I had similar issue, found it was all down to permissions

  1. enabling LWC in the Site: in the Salesforce UI - on Setup > Sites > (your site page) > tick 'Lightning Features for Guest User

  2. making sure Lightning Application is set with:
    <aura:application extends="ltng:outApp" access="GLOBAL" implements="ltng:allowGuestAccess">