rivescript-js icon indicating copy to clipboard operation
rivescript-js copied to clipboard

Unable to load rivescript-js resource from online source

Open CodeRoller opened this issue 7 years ago • 7 comments
trafficstars

I'm trying out rivescript-js on my localhost. I have an html page that calls the online rivescript with

But I am getting a 404 error that the resource failed to load.
I have also tried to call my local rivescript.js but that didn't work either. Nothing has successfully loaded and I am not sure what is wrong. Any help would be appreciated. I am running Tomcat 9.0 server on Windows 10. My Tomcat is running and does jsp files fine.

CodeRoller avatar Nov 07 '18 02:11 CodeRoller

Can you copy and paste the part of your HTML where your script tag is placed? I can load the CDN link just fine as text in the browser, so maybe there's a typo somewhere.

Are you getting a 404 for the script or are you getting a 404 for the page itself? i.e., are you able to load the page, but seeing a 404 for rivescript.min.js in the network tab of dev tools? Or are you unable to load the page in its entirety?

kjleitz avatar Nov 07 '18 15:11 kjleitz

right this URL works fine https://unpkg.com/rivescript@latest/dist/rivescript.min.js

at least paste the client side error logs here... If you're serving up a JSP page, with the URL embedded, perhaps the URL is escaped/encoded somehow. what you see in the source might not what you think it is. https://www.urlencoder.org/

dcsan avatar Nov 07 '18 16:11 dcsan

Can confirm the unpkg.com CDN link works. The exact URL is used on the RiveScript Playground and the Try Online pages and those work for me now.

Some other blind ideas to try:

  • Is the unpkg.com domain completely blocked from your network? Might explain the 404 or if there's a filter in place preventing this domain from your server environment.
  • If the two links above work (using the same CDN URL you are) but yours doesn't, find what's different between the environments.
  • Is the script being included "server side" by any means? (not sure how a <script> tag would be a server side concern but I've seen weird things) and if so there may be different network environments.
  • Is it running from an environment with permission enforcement? i.e. in a Cordova application for Android; if you didn't grant it Internet access it might be blocked from loading an external script (if you're doing something like this: embed rivescript.js directly with your app, so it wouldn't break when the user loses internet access anyway)

kirsle avatar Nov 07 '18 16:11 kirsle

hi -

Thank you for your suggestions - I solved the problem at dawn, it turned out when I was fooling around with the code, before putting it on my local host, I created typos and used a Word Processor all of which contributed to extraneous characters in the output.  When I chose "inspect" in the browser I saw the situation and corrected it. Now it's working perfectly, and I am super excited about the possibilities of rivescript!   Again thanks for our help. Amy

CodeRoller avatar Nov 08 '18 05:11 CodeRoller

hi -

You were onto something. Thank you for your suggestions - I solved the problem at dawn, it turned out when I was fooling around with the code, before putting it on my localhost, I created typos and used a Word Processor all of which contributed to extraneous characters in the output, i.e. escape codes

When I chose "inspect" in the browser I saw the situation and corrected it. Now it's working perfectly, and I am super excited about the possibilities of rivescript!   Again thanks for our help. Amy

CodeRoller avatar Nov 08 '18 05:11 CodeRoller

there are lots of free plain text/code editors like VSCode or Notepad++ (on windows). best not to use a word processor for code 👩‍💻

dcsan avatar Nov 08 '18 06:11 dcsan

Yes, I will probably start using one since the error I made is a common one which I would have probably caught much quicker in the past when I was a full-time programmer. Thanks again! Now I can enjoy the benefits of Rivescript which really fascinates me.

CodeRoller avatar Nov 08 '18 07:11 CodeRoller