You need to sign in to do that
Don't have an account?
Manoj Thangavel
lightning out in public non-SF web site
Hello,
I am trying to add my aura component to a public web site. I have seen that lightning out can help.
I have a simple component and application in lightning. and trying to the website, but not able to succeed. Finally stuck with 500 internal server error.
My component:
<aura:component access="global">
<p>
Hello Lightnign World!
</p>
</aura:component>
My app:
<aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess" >
<aura:dependency resource="c:TestOutComponent"/>
</aura:application>
I have tried with both SF lightning and Community URL.
for SF user, am stuck with CORS Error, even though I have added my domain in CORS.
for Community, I can see the lightning library loaded into my web site but finally got 500 internal server error.
Below code has community URL.
Site HTML page:
<html>
<head>
<script src="https://prizmahlabs-developer-edition.ap7.force.com/lightning/lightning.out.js"></script>
<script>
$Lightning.use("c:TestOutApp",
function() {
$Lightning.createComponent(
"c:TestOutComponent",
{ },
"lightning",
function(cmp) {
alert('success!');
// callback when component is created and active on the page
}
);
},
'https://prizmahlabs-developer-edition.ap7.force.com' // Community endpoint
);
</script>
</head>
<body>
<h1>Hello World</h1>
<div id="lightning">
</div>
</body>
</html>
I am trying to add my aura component to a public web site. I have seen that lightning out can help.
I have a simple component and application in lightning. and trying to the website, but not able to succeed. Finally stuck with 500 internal server error.
My component:
<aura:component access="global">
<p>
Hello Lightnign World!
</p>
</aura:component>
My app:
<aura:application access="GLOBAL" extends="ltng:outApp" implements="ltng:allowGuestAccess" >
<aura:dependency resource="c:TestOutComponent"/>
</aura:application>
I have tried with both SF lightning and Community URL.
for SF user, am stuck with CORS Error, even though I have added my domain in CORS.
for Community, I can see the lightning library loaded into my web site but finally got 500 internal server error.
Below code has community URL.
Site HTML page:
<html>
<head>
<script src="https://prizmahlabs-developer-edition.ap7.force.com/lightning/lightning.out.js"></script>
<script>
$Lightning.use("c:TestOutApp",
function() {
$Lightning.createComponent(
"c:TestOutComponent",
{ },
"lightning",
function(cmp) {
alert('success!');
// callback when component is created and active on the page
}
);
},
'https://prizmahlabs-developer-edition.ap7.force.com' // Community endpoint
);
</script>
</head>
<body>
<h1>Hello World</h1>
<div id="lightning">
</div>
</body>
</html>
VM292:1 Uncaught SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at lightning.out.delegate.js?v=1593956343302:143
at XMLHttpRequest.xhr.onreadystatechange (lightning.out.delegate.js?v=1593956343302:112)
The change if, in the web site JS code, I have amended my community URL as below
<html>
<head>
<script src="https://prizmahlabs-developer-edition.ap7.force.com/lightning/lightning.out.js"></script>
<script>
$Lightning.use("c:TestOutApp",
function() {
$Lightning.createComponent(
"c:TestOutComponent",
{ },
"lightning",
function(cmp) {
alert('success!');
// callback when component is created and active on the page
}
);
},
'https://prizmahlabs-developer-edition.ap7.force.com/s' // Community endpoint
);
</script>
</head>
<body>
<h1>Hello World</h1>
<div id="lightning">
</div>
</body>
</html>