Using WebRelay Tunnel with Node Red Dashboard

I have been using a Webhook Relay tunnel to be able to access my dashboard from anywhere not just my network. However I get a blank page:

If I access the dashboard normally It works fine.

In the inspect mode console I get the error:
WebSocket connection to 'ws://############.webrelay.io/ui/socket.io/?EIO=3&transport=websocket&sid=###########P' failed: WebSocket is closed before the connection is established.

However If I use a fork of the dashboard - mdashboard It all loads fine? I am presuming this is as it is an older version of the dashboard.

I have only got 2 testing nodes in my whole flow (I would upload an image but I'm limited to 2)
They are just a text node for each dashboard

The same issue occurs no matter what combination of dashboards I have. (It still occurs if I only have just one dashboard downloaded)

Any help would be greatly appreciated.

Does your tunnel support websockets?

Yes, I believe so, but may correct me if I seem wrong.
For me its the fact that mdashboard (updated 1 yr+ ago) works that suggests its a new update to the dashboard pallet that causes it or is incompatible. It is possible to use an old version of it as a temporary fix?

I have no idea whether your tunnel supports websockets or not.

I also know nothing about mdashboard apart from the fact the fact that it is (I believe) a fork of an old version of the dashboard.

I have used a 19mnth old version of the dashboard ( node-red/node-red-dashboard at 7bcfaeb45c109687f59a79ac53a720937807d3c4 (github.com)) in my node_modules file, and all is working fine now, if not necessarily ideal

That doesn't really seem like a "solution" to me. It would be interesting, if you had time, to test a uibuilder node over your tunnel.

Like Dashboard, uibuilder uses Socket.IO for the comms. Indeed if you try the v4.0.0 beta (install manually from GitHub), it uses Socket.IO v4 which is the latest version. (needs Node.js v12+).

I'm not sure what mdashboard uses but this test might indicate whether it is a Socket.IO issue.

Wait, hang on - that is a ws: connection - over the Internet? Surely it should be a wss: connection?

Will download the uibuilder node later today, but here is the error code:
Untitled

I don't know if ws compared to wss would make a difference in this sense (You know more than me) , I don't need it to be secure for my use purposes (I do have a password on my node red but that also reminds me to change my tunnel to just the /ui path or /uibuilder path)

Well I doubt the ws: will make a difference to the error it is true. However, it is bad practice to have unsecured connections over the internet no matter how much you think it doesn't matter. You should at least make sure that the end-to-end connection is secure because otherwise you don't know what else could be done on that connection.

I've noted previously that a similar service NGROK, by default, creates insecure connections and this is a really bad thing because it can leave people feeling secure when they are not.


That aside, if you are testing with uibuilder, there are several url paths that you will need.

Best practice would be to change the url root for the Editor certainly and to block remote access to it.

For uibuilder, you need //<httpRoot>/uibuilder/* and whatever url you have given to each uibuilder node //<httpRoot>/<url>/*.

Where httpRoot is set in the node-red settings.js and is empty by default. url is set in each uibuilder node.

All these details are shown in the uibuilder details and instance details buttons.
image

1 Like

Untitled

Hopefully worth the ÂŁ2 a month

There are other similar tools around if WebRelay.io isn't working.

Just installed Ui Builder (Non Beta) and it works fine:

Now installing Ui Builder Beta from GitHub to see how that compares

1 Like

I assume you did exchange some data :grinning:

The non-beta version uses Socket.IO v2, the beta version uses Socket.IO v4, shouldn't really be any difference though.

At least this tells us that it isn't a fundamental Socket.IO problem.

1 Like

Although you can't see it in the image I sent, I did after taking the image use the increment button and it all worked fine.

1 Like

Just attempting to use the beta and when starting up node red I get the error:
3 Jul 16:16:18 - [warn] [node-red-contrib-uibuilder/uibuilder] Error: Cannot find module 'fs-extra'

And in the pallete manager I get the error:
image

Does this tell you anything?

Edit: I have checked I have got Node.js 12

That tells me that I don't think uibuilder installed correctly.

The installation of uibuilder should also install fs-extra unless it is already installed.

Can you please use a command prompt on your node-red server:

cd ~/.node-red
npm outdated

You should get something like:

home@home:~/nrmain/data$ npm outdated
Package                        Current  Wanted  Latest  Location
node-red-contrib-uibuilder       4.0.0     git     git  node-red-userdir
home@home:~/nrmain/data$

You may get others of course as well. Your location will probably also say something different. The important thing is that it is showing 4.0.0/git/git.

Just tested on my debian server. Updated to v4 from github and it works ok:

image

Try reinstalling from the command line and restarting Node-RED.

You should get something like this when installing:

home@home:~/nrmain/data$ npm install totallyinformation/node-red-contrib-uibuilder

> node-red-contrib-uibuilder@4.0.0 preinstall /home/home/nrmain/data/node_modules/node-red-contrib-uibuilder
> node ./bin/uibpreinstalljs

======================================= [UIBUILDER PREINSTALL] =======================================
Please ignore warnings about missing peer dependencies for jquery, vue, bootstrap-vue
*** WARNING: npm is incapable of safely installing packages from within pre-/post-install scripts. ***
             So vue and bootstrap-vue are no longer installed by uibuilder.
             You must install them yourself using the command:
                 npm install vue@"2.*" bootstrap-vue@"2.*"
==================================================================================================

+ node-red-contrib-uibuilder@4.0.0
added 14 packages from 62 contributors, removed 1 package, updated 2 packages and audited 773 packages in 10.688s

61 packages are looking for funding
  run `npm fund` for details

found 6 vulnerabilities (4 low, 2 high)
  run `npm audit fix` to fix them, or `npm audit` for details

I get this error:
4 Jul 14:21:48 - [warn] [node-red-contrib-uibuilder/uibuilder] SyntaxError: Unexpected token '( ' (line:34)

pi@raspberrypi:~/.node-red $ npm install totallyinformation/node-red-contrib-uibuilder

> node-red-contrib-uibuilder@4.0.0 preinstall /home/pi/.node-red/node_modules/node-red-contrib-uibuilder
> node ./bin/uibpreinstalljs

======================================= [UIBUILDER PREINSTALL] =======================================
Please ignore warnings about missing peer dependencies for jquery, vue, bootstrap-vue
*** WARNING: npm is incapable of safely installing packages from within pre-/post-install scripts. ***
             So vue and bootstrap-vue are no longer installed by uibuilder.
             You must install them yourself using the command:
                 npm install vue@"2.*" bootstrap-vue@"2.*"
==================================================================================================


+ node-red-contrib-uibuilder@4.0.0
added 84 packages from 126 contributors, updated 2 packages and audited 258 packages in 36.304s

24 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

pi@raspberrypi:~/.node-red $ npm outdated
Package                     Current  Wanted  Latest  Location
node-red-contrib-uibuilder    4.0.0     git     git  node-red-project
pi@raspberrypi:~/.node-red $ node-red-restart

pi@raspberrypi:~/.node-red $ node-red-stop && node-red-start

Stop Node-RED

Use   node-red-start   to start Node-RED again


Start Node-RED

Once Node-RED has started, point a browser at http://192.168.1.153:1880
On Pi Node-RED works better with the Firefox or Chrome browser

Use   node-red-stop                          to stop Node-RED
Use   node-red-start                         to start Node-RED again
Use   node-red-log                           to view the recent log output
Use   sudo systemctl enable nodered.service  to autostart Node-RED at every boot
Use   sudo systemctl disable nodered.service to disable autostart on boot

To find more nodes and example flows - go to http://flows.nodered.org

Starting as a systemd service.
4 Jul 14:21:46 - [info]
Welcome to Node-RED
===================
4 Jul 14:21:46 - [info] Node-RED version: v1.3.5
4 Jul 14:21:46 - [info] Node.js  version: v12.22.2
4 Jul 14:21:46 - [info] Linux 5.10.17-v7l+ arm LE
4 Jul 14:21:47 - [info] Loading palette nodes
4 Jul 14:21:48 - [info] mDashboard version 2.19.4-beta started at /mui
4 Jul 14:21:48 - [info] Dashboard version 2.29.3 started at /ui
4 Jul 14:21:48 - [warn] ------------------------------------------------------
-----> 4 Jul 14:21:48 - [warn] [node-red-contrib-uibuilder/uibuilder] SyntaxError: Unexpected token '( ' (line:34) <------
4 Jul 14:21:48 - [warn] ------------------------------------------------------
4 Jul 14:21:48 - [info] Settings file  : /home/pi/.node-red/settings.js
4 Jul 14:21:48 - [info] Context store  : 'default' [module=memory]
4 Jul 14:21:48 - [info] User directory : /home/pi/.node-red
4 Jul 14:21:48 - [warn] Projects disabled : editorTheme.projects.enabled=false
4 Jul 14:21:48 - [info] Flows file     : /home/pi/.node-red/flows_raspberrypi.json
4 Jul 14:21:48 - [info] Server now running at http://127.0.0.1:1880/
4 Jul 14:21:48 - [warn]


image

Right, I've just removed the .js that had crept onto some of the require statements. That is the only thing I can think of that could be an issue on that line. It works fine with Node.js v14 so might be a v12 issue.

Sorry to get you to keep doing this but if you wouldn't mind reinstalling uibuilder again.

The beta does now include a whole bunch of other fixes that I came across as I was working through everything. Also the custom ExpressJS server feature and the custom uibRoot folder location feature both now work.

Hopefully, this is the last update before release.

Sorry for the delay, but I have just upgraded to Node.js V14 and have re installed UiBuilder and still receive the same issue: 10 Jul 14:20:35 - [warn] [node-red-contrib-uibuilder/uibuilder] SyntaxError: Unexpected token '(' (line:32)
It works with the Non Beta UiBuilder version of which it has the same version of socket.io as dashboard, so is it neccessary to try the socket io v4?

Thanks for your help thus far.

Might try a different tool than a WebHookRelay tunnel, to see if it makes a difference.

I'm really confused by this. I've just been running final tests on v4 and it is working just fine even for a fresh install of Node-RED. I cannot reproduce that error.

If you go to your userDir folder in a command prompt and run npm ls --depth=1 you should get something that looks a bit like this:

You don't need to worry about the unmet peer dependency and you probably won't get the extraneous lines in your output.

Note that I have an instance of Node-RED with ONLY uibuilder node installed but then with vue and bootstrap-vue installed via uibuilder's front-end library manager so that the vue template can be used. You won't see those if you don't have them installed of course. You may see a much bigger listing if you have other nodes installed.

Important line is socket.io@4.1.2.


Now, I have managed to reproduce a similar error to what you are seeing. But only by manually creating an error in the nodes/socket.js module file. By adding an extraneous , on line 413, I get:

10 Jul 16:42:18 - [warn] [node-red-contrib-uibuilder/uibuilder] SyntaxError: Unexpected token ',' (line:32)

But I don't know why you are seeing this because I have fully checked the socket.js file and there are certainly no syntax errors.

So I can't help feeling, especially given your original problems, that this is something to do with your environment.

Can you show me a directory listing of the ~/.node-red/node_modules/node-red-contrib-uibuilder/nodes/ and ~/.node-red/node_modules/node-red-contrib-uibuilder/templates/ folders? including file sizes and dates? I would like to check whether you actually have the right files.

Could you also please share your versions of the ~/.node-red/node_modules/node-red-contrib-uibuilder/nodes/socket.js and the ~/.node-red/node_modules/node-red-contrib-uibuilder/nodes/uibuilder.js files? (actually I only need the first 40 lines of uibuilder.js)