aws-lex-web-ui icon indicating copy to clipboard operation
aws-lex-web-ui copied to clipboard

Must deploy to the root?

Open russell-oit opened this issue 2 years ago • 6 comments

It looks like I have to deploy this code to a website at its root. Can we clean up the relative paths to make it deployable to a subdirectory?

The UI tries to get resource files from the root as in: /./lex-web-ui.min.css

russell-oit avatar Dec 30 '21 17:12 russell-oit

Hi Russell,

What file do you see that reference? In the dist folder, index.html references look like this:

<link href="lex-web-ui-loader.min.css" rel="stylesheet">
<link rel="stylesheet" href="./custom-chatbot-style.css">

Chris

chrislott avatar Dec 30 '21 20:12 chrislott

Another installation approach is to deploy using the prebuilt cloudformation template and embed the snippet of html available as output from the stack. This approach brings the bot up in an iframe separate from the the hosting page. This is perhaps the easiest mechanism to deploy and keep the UI updated over time with updates.

Can you share how you've setup loading the bot? The following link will take you to some of the general approaches. https://github.com/aws-samples/aws-lex-web-ui#stand-alone-page

bobpskier avatar Dec 31 '21 03:12 bobpskier

Hi Russell,

What file do you see that reference? In the dist folder, index.html references look like this:

<link href="lex-web-ui-loader.min.css" rel="stylesheet">
<link rel="stylesheet" href="./custom-chatbot-style.css">

Chris

Chris, I saw that from the error that the file was not loaded. It was in javascript

russell-oit avatar Dec 31 '21 16:12 russell-oit

HI @russell-oit, yes this is the issue. If we put bot in the subdirectory, it will not work.

www -----HTML - ROOT -----index.html -------------------bot-src -------------------bot-files ( cofig, loader, css, etc)

with this setup, I am unable to load IFrame. It is keep on throwing error for invalid references of css files

AbhishekDesai99 avatar Mar 20 '22 09:03 AbhishekDesai99

@bobpskier hey please help, if you want I can show you my internal s3 bucket structure as well. I am hosting it as s3 bucket static website. I am able to load it with different origins setup, but that approach takes too long to load the bot, and we need to maintain some speed for optimization engine counts, we want to host bot flles within the same setup. But we don't want to spoil our root directory structure. Is there anything I can do to solve it ?

AbhishekDesai99 avatar Mar 20 '22 09:03 AbhishekDesai99

@AbhishekDesai99 I believe the loaderOpts supports that ability to specify a baseUrl. See https://github.com/aws-samples/aws-lex-web-ui/blob/master/src/README.md#loader-constructor-options. This might allow you to specify a path relative to root to find the bot files.

bobpskier avatar Mar 23 '22 03:03 bobpskier