UCPNode Not Running. Attempts to Re-Install Failed

Running FreePBX 13.0.191.11
ucpnode is not running and fails to start up.

I have already done the following:
ensured distro up to date
ensured all modules and framework up to date
uninstalled nodejs/npm
chowned permissions
reinstalled nodejs/npm
uninstalled and reinstalled ucpnode

here is the output from my ucpnode_err.log:

2017-05-31 11:55 -04:00: Error: Cannot find module '../build/Debug/sqlclient'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/var/www/html/admin/modules/ucpnode/node/node_modules/mariasql/lib/Client.js:13:11)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
[root@freepbx /]# cat /var/log/asterisk/ucpnode_err.log 

I am open to suggestions as at this point I am completely stuck.
As a thought process, I am wondering if my self-signed certificate is screwing this up somehow (I did once try and failed to do a LetsEncrypt Certificate).

Anyone have any ideas on this?

Go to Advanced Settings and enable ā€œUse Proxy Server for NPMā€

Then remove ucpnode. fwconsole ma remove ucpnode.

Then redownload. fwcosnole ma downloadinstall ucpnode

I donā€™t see that option in Advanced Settings

Turn on these options

OK. Its downloading and installing nowā€¦
In the interim, can you confirm these settings are correct when using a self-signed cert?

How long should the download install process take? In the past it was very quick, right now its just hanging out at

ā€œInstalling/Updating Required Libraries. This may take a whileā€¦The following messages are ONLY FOR DEBUGGING. Ignore anything that says ā€˜WARNā€™ or is just a warningā€

A long while.

Hah ok. I will let it run for a while.
Would you mind explaining what exactly is happening here? Why has this become an issue for me?

Sure!

So this is NPM & NODEJS. We use nodejs primarily for realtime communications libraries. We need this over PHP because PHP isnā€™t well suited for what we call ā€œnon-blocking tasksā€ what I mean by this is when i query the database in PHP it blocks the thread (the process) until it receives an event. This is fine in HTTP world. But in the world of realtime communications that block blocks the entire server so if you have 100 people connected and you are always blocking the server with requests nothing will be real time. Enter node and itā€™s ā€œnon-blockingā€. High level overview.

Node has a package manager called NPM. During the install of modules we tell NPM to go out and and install a list of requirements. For ucpnode theres a list of about 6. Of those 6 they have dependencies and the list goes on. During their install process they go out and download requirements and/or they compile themselves locally against your system. In your case both of those things are happening. Which can make the process slow down.

On top of that some firewalls donā€™t like all of this network activity and they start to slow the connection down or timeout, which causes issues. Since we are using NPM this is sometimes hard to figure out when this has occurred, we are still working on it. This can also leave you in weird states where NPM says it installed everything but in reality it didnā€™t, hence ā€œcannot find moduleā€ā€¦

The process should eventually output something but it really depends on processor, ram, disk speed and bandwidth. Unfortunately these npm issues are out of our control, but we are trying to figure out how to make them better, itā€™s just usually a result of network issues which makes them glitch out. Over PHP that is.

1 Like

Still not working after this.

Uninstall it then. In the future you will not be able to use UCP unfortunately.

So what is the reasoning for this? In the beginning of my deployment it was working.

What is the reasoning for what?

Sorry. To be more specific. I read your paragraph above and I understand that a lot of this is out of my control. What confuses me is that it was working when the deployment was initially rolled out (Jan. '17). It seems like over time upgrades and changes have caused this to no longer function. Will this be something I should just live with for the foreseeable future? Is there nothing else I can do? Will this functionality ever be restored?

Thereā€™s nothing that changed in this aspect since Jan 17.

Try upgrading pm2 to version 13.0.3.9

Then you will have an option in Advanced Settings (you need to turn on read-only mode) that says ā€œUse package caching for NPMā€. Set this to false. Then try to install ucpnode. May or may not work.

I donā€™t see 10.0.3.9
Do i have to change repos?

You can upgrade a single module from the edge repo with fwconsole::

fwconsole ma upgrade --edge pm2

I edged updated pm2 and then tried to edge update ucpnode. Everything goes fine for the pm2 upgrade but the ucpnode upgrade ends up hanging on Starting New UCP Node Processā€¦