Failed to start and connect to local ccdaservice server on port 6661

Ok, some history is due here. I have an instance that started off life as v4.2.0.
We made the leap from that version to v6.0.0(4). The program is heavily modified (but not core).
Last weekend we made the leap to v6.1.0.

Ubuntu 18.04
Apache 2.4x
MySQL 14.14
AWS

After entering the missing table columns and setting the config in the globals. In the error log I see this message.

  Failed to start and connect to local ccdaservice server on port 6661

This is a WTF (what the fun, we are having!) moment.
I compared the setting against the demo version and there are no ports set.
So, I dug through the code and found the serveccda.js where the port is being listened to.

The ufw is inactive. What could be blocking the communications on the localhost?

GET https://e.myaws_server.org/interface/modules/zend_modules/public/encounterccdadispatch/index?combination=61356&view=1&recipient=self&param=642 500 (Internal Server Error)

Scan to see if the port is being held open by something else --something else on the machine mightā€™ve claimed 6661?

Can you manually start the ccda service from the command line? Iā€™d isolate that first and figure out if its something on the node side or something on php being unable to call out to the node service.

How do I start the service?
How do I know the service is running?
There is no documentation on how to start the service manually.

I un-commented debug. Reading this ran the npm i- production and still says it cannot connect.

I navigated to the folder and ran node serviceccda.js
I then entered the program and click on a patient and got this

ccda.txt (2.3 KB)

My node version is 12.18.2.

Ok, if I manually start the service I can print out a CCDA.

I needed to comment out //Debug. That is what was giving me the other error in the text file.

Iā€™m no expert on this, am just learning about CCDA myself but have gotten it working.

Why is it youā€™re using Node.js version 12? The OpenEMR documentation recommends installing it from upstream and says itā€™s tested with version version 14. Node.js version 12 is end-of-life on 2022-04-30 where as version 14 is end-of-life on 2023-04-30.

Did you run ā€œnpm initā€ before running ā€œnpm install --productionā€?

Are you using ā€œnpm install --productionā€ with or without sudo?
OpenEMRā€™s ccdaservice README.md recommends using sudo but in reading around Iā€™ve found people recommending not doing so, so Iā€™m currently not.

Are you using ā€œAllowOverride FileInfoā€ in the Apache config?

2 Likes

Pete,
thanks for joining the conversation. This is not a new install. This is a migration that has lots of modifications that required me to redo the modification from a previous version 4.2.0 into v6. I started back when version 6.0.0 was released. I have to migrate a little code at a time see what breaks and fix it. I have not read the new documentation on which version of npm the system should be using. Thanks for the info =^).
I will upgrade the npm on the server. I brought up the server last year and when version 12 of npm was fine. Every suggestions helps get me closer to the solution.

I ran the command to remove nodejs. The results are that node version stays the same.

  ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ node -v
  v16.14.2
  ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo apt-get remove --purge nodejs npm
  Reading package lists... Done
  Building dependency tree
  Reading state information... Done
  Package 'npm' is not installed, so not removed
 The following packages were automatically installed and are no longer required:
  gyp libc-ares2 libhttp-parser2.7.1 libicu60 libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev   \libuv1-dev python-pkg-resources
  Use 'sudo apt autoremove' to remove them.
  The following packages will be REMOVED:
  nodejs*
 0 upgraded, 0 newly installed, 1 to remove and 16 not upgraded.
 After this operation, 123 MB disk space will be freed.
 Do you want to continue? [Y/n] Y
 (Reading database ... 190930 files and directories currently installed.)
 Removing nodejs (14.19.1-1nodesource1) ...
 Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
 ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ node -v
 v16.14.2
 ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$

I ran

 sudo apt-get install -y nodejs

This is what happened next.

 Reading package lists... Done
 Building dependency tree
 Reading state information... Done
 The following packages were automatically installed and are no longer required:
 gyp libc-ares2 libhttp-parser2.7.1 libicu60 libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev libuv1-dev python-pkg-resources
 Use 'sudo apt autoremove' to remove them.
 The following NEW packages will be installed:
 nodejs
 0 upgraded, 1 newly installed, 0 to remove and 16 not upgraded.
 Need to get 0 B/25.5 MB of archives.
 After this operation, 123 MB of additional disk space will be used.
 Selecting previously unselected package nodejs.
 (Reading database ... 185968 files and directories currently installed.)
 Preparing to unpack .../nodejs_14.19.1-1nodesource1_amd64.deb ...
 Unpacking nodejs (14.19.1-1nodesource1) ...
Setting up nodejs (14.19.1-1nodesource1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...

Then ran:

ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo npm install --production

up to date, audited 102 packages in 977ms

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

5 vulnerabilities (4 moderate, 1 high)

To address issues that do not require attention, run:
npm audit fix (Brady said never fix these)

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

It should be working but it is not. I am going to reboot the server as a last resort.

Seems to have gotten worse now that I upgraded. Node -v is still 16.x.x Nodejs version is 14.x

ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ nodejs serveccda.js
/var/www/html/hb600/ccdaservice/node_modules/bindings/bindings.js:121
		throw e;
		^

Error: The module '/var/www/html/hb600/ccdaservice/node_modules/libxmljs2/build/Release/xmljs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 72. This version of Node.js requires
NODE_MODULE_VERSION 83. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
	at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
	at Module.load (internal/modules/cjs/loader.js:950:32)
	at Function.Module._load (internal/modules/cjs/loader.js:790:12)
	at Module.require (internal/modules/cjs/loader.js:974:19)
	at require (internal/modules/cjs/helpers.js:101:18)
	at bindings (/var/www/html/hb600/ccdaservice/node_modules/bindings/bindings.js:112:48)
	at Object.<anonymous> (/var/www/html/hb600/ccdaservice/node_modules/libxmljs2/lib/bindings.js:1:37)
	at Module._compile (internal/modules/cjs/loader.js:1085:14)
	at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
	at Module.load (internal/modules/cjs/loader.js:950:32) {
  code: 'ERR_DLOPEN_FAILED'
}

Sherwin delete the ccdaservice directory. replace ccdaservice directory from install zip.
Now npm -install. I believe node 16 works and is what we use on demo farm.

Also using -production is no longer needed.

1 Like

I removed and replaced the directory with the one from the install zip. Ran the npm i command. Here are the results.

ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo npm i

added 68 packages, and audited 70 packages in 2s

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

1 high severity vulnerability

To address all issues, run:
  npm audit fix

Run `npm audit` for details.

Not so fast. When I select a patient chart. The new tab opens and just swirls. Never loads. It just goes in circles. I am getting dizzy.

congrates you are now the proud owner of a healthy new ccda baby boy!

what that have to do with ccda? also you may have an old node process running from testing. try start service from command line or reboot.

Upgrading old systems is the pits sometimes. Here is what happened after the reboot.

ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ node serveccda.js
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: 00/00/0000, _f: undefined, _strict: undefined, _locale: [object Object]
Error
	at Function.createFromInputFallback (/var/www/html/hb600/node_modules/moment/moment.js:319:25)
	at configFromString (/var/www/html/hb600/node_modules/moment/moment.js:2536:19)
	at configFromInput (/var/www/html/hb600/node_modules/moment/moment.js:2978:13)
	at prepareConfig (/var/www/html/hb600/node_modules/moment/moment.js:2961:13)
	at createFromConfig (/var/www/html/hb600/node_modules/moment/moment.js:2928:44)
	at createLocalOrUTC (/var/www/html/hb600/node_modules/moment/moment.js:3022:16)
	at createLocal (/var/www/html/hb600/node_modules/moment/moment.js:3026:16)
	at Function.createInZone [as parseZone] (/var/www/html/hb600/node_modules/moment/moment.js:4985:28)
	at exports.time (/var/www/html/hb600/ccdaservice/oe-blue-button-generate/lib/translate.js:74:20)
	at /var/www/html/hb600/ccdaservice/oe-blue-button-generate/lib/engine.js:29:27
Error
File:
/var/www/html/hb600/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Controller/EncounterccdadispatchController.php:172
Message:
Call to undefined function Carecoordination\Controller\simplexml_load_string()
Stack trace:
#0 /var/www/html/hb600/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(77): Carecoordination\Controller\EncounterccdadispatchController->indexAction()
#1 /var/www/html/hb600/vendor/laminas/laminas-eventmanager/src/EventManager.php(331): Laminas\Mvc\Controller\AbstractActionController->onDispatch()
#2 /var/www/html/hb600/vendor/laminas/laminas-eventmanager/src/EventManager.php(188): Laminas\EventManager\EventManager->triggerListeners()
#3 /var/www/html/hb600/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(103): Laminas\EventManager\EventManager->triggerEventUntil()
#4 /var/www/html/hb600/vendor/laminas/laminas-mvc/src/DispatchListener.php(139): Laminas\Mvc\Controller\AbstractController->dispatch()
#5 /var/www/html/hb600/vendor/laminas/laminas-eventmanager/src/EventManager.php(331): Laminas\Mvc\DispatchListener->onDispatch()
#6 /var/www/html/hb600/vendor/laminas/laminas-eventmanager/src/EventManager.php(188): Laminas\EventManager\EventManager->triggerListeners()
#7 /var/www/html/hb600/vendor/laminas/laminas-mvc/src/Application.php(331): Laminas\EventManager\EventManager->triggerEventUntil()
#8 /var/www/html/hb600/src/Core/ModulesApplication.php(116): Laminas\Mvc\Application->run()
#9 /var/www/html/hb600/interface/modules/zend_modules/public/index.php(73): OpenEMR\Core\ModulesApplication->run()
#10 {main}

Iā€™ve seen that recently. I seem to remember that itā€™s not an issue though; Iā€™m looking for it in my notesā€¦
Are you still generating a downloadable CCDA?

Where do I do that? I looked in the Reports and the CCDA has been removed from there.

Modules > Carecoordination > Export > Transition Of Care > Search

Date - set date range
Search - a search without specifying a patient brings up all records)

You should get a list of results. Select one.

Send to > Download > CCDA

Guys, have you installs all your xml extension for OS?
xml
xmlreader
xmlwriter
xsl

Jerry, I should have but to be through, I will.

ubuntu@ip-172-31-27-136:/var/www/html/hb600/ccdaservice$ sudo apt-get install php7.4-xml
Reading package listsā€¦ Done
Building dependency tree
Reading state informationā€¦ Done
The following packages were automatically installed and are no longer required:
gyp libc-ares2 libhttp-parser2.7.1 libicu60 libjs-async libjs-inherits libjs-node-uuid libssl1.0-dev libuv1-dev python-pkg-resources
Use ā€˜sudo apt autoremoveā€™ to remove them.
The following NEW packages will be installed:
php7.4-xml
0 upgraded, 1 newly installed, 0 to remove and 17 not upgraded.

Still no joy after restarting Apache.

No joy in what way? Are you able to export a CCDA .zip file, despite the error at the terminal?