Channel Web - not working

Friends,

I’m getting this error in console in all browsers:

Uncaught TypeError: Cannot read property 'init' of undefined at (index):30

In Chrome, the first line shows that it didn’t found inject.js:
Failed to load resource: net::ERR_SSL_PROTOCOL_ERROR

MS Edge didn’t tell much about it:
Unexpected token

In Firefox, the message is cryptic:
Failure on loading <script> with the source

My scripts:

<script src="https://botboutique.com.br:3030/data/assets/modules/channel-web/inject.js"></script>

<script>
    window.botpressWebChat.init({ host: 'https://botboutique.com.br:3030', botId: 'primobot' })
</script>

When I change to ({host: 'botboutique.com.br:3030', botId: 'primobot' }) I get this message in console:

TypeError: window.botpressWebChat is undefined

Any clues for me?

@LuizCesarLeite Can you please check you nginx error log, looks like nginx is unable to serve files. Might be something related to HTTPs configuration.

Hi @abhisheksimion!

Yes. I think that’s because I’m using Apache2 with an Certbot’s cert to serve my pages and maybe it the reason to mess everything.

I’m quite lost on this matter, I really don’t know what to do…

@LuizCesarLeite Can you try mkcert?

Here are the steps on a windows system

  1. Install choco if not already present
  2. Open powershell in administrator mode then run below command
    Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
  3. choco install mkcert
  4. mkcert -install
  5. mkcert botboutique.com.br localhost 127.0.0.1 ::1

Now, use the newly created .pem files as shown in below screenshot

Here is a screenshot of my staging environment, where this works using mkcert

@abhisheksimion

I’m running my VPS on Ubuntu 18.04 LTS, using Apache2 to serve my pages.

Can I use your suggestion anyway?

@LuizCesarLeite I created these certs on a windows machine and then transferred it to a RHEL system (staging box). So yes it will work on Ubuntu. You just need to follow steps to install mkcert on Linux.

@abhisheksimion

I was reading the link that you show and

“mkcert does not automatically configure servers to use the certificates, though, that’s up to you.”

I guess that mkcert won’t brake my existing certs nor mess up with Apache2, so I´ll give it a try.

But the main problem is how to make the Nginx instance inside BP recognizes this cert …

Am I right?

@abhisheksimion

mkcert refuses to run :frowning:

Do you have a windows system where you can try installing mkcert?

@abhisheksimion, I turned to Nginx and open another thread :slight_smile: