I'm trying implement Amazon lex chatbot in company public website and in experience cloud.
its working fine in company public website.
but in Salesforce Community cloud it giving below error
Error: chatbot loading time out at e.onConfigEventTimeout (iframe-component-loader.js:524:23) (anonymous) @ (index):23
Below is the script I added in Salesforce --> Setup --> builder --> settings --> Edit markup
<script>
var loaderOpts = {
baseUrl: 'https://dxyz13123.cloudfront.net/',
shouldIgnoreConfigWhenEmbedded: false,
shouldLoadMinDeps: true,
configUrl: './lex-web-ui-loader-config-en-custom.json',
};
var loader = new ChatBotUiLoader.IframeLoader(loaderOpts);
var chatbotUiConfig = {
/* Example of setting session attributes on parent page
lex: {
sessionAttributes: {
userAgent: navigator.userAgent,
QNAClientFilter: ''
}
}
*/
};
loader.load(chatbotUiConfig)
.catch(function (error) { console.error(error); });
</script>
<style>
.lex-web-ui-iframe iframe {
border-radius: 0;
margin: 1px;}
</style>```
In Salesforce --> Setup --> builder --> settings --> Security level set to "Relaxed CSP: Permit Access to Inline Scripts and Allowed Hosts"
And even added trusted sites.
Thanks in advance.
As per AWS support they currently do not support multiple parent sites to point to the same chatbot.
So I created a new Lex instance for this but pointing to the same chatbot and updated new URL to Salesforce CSP list.
Then it started working.