404 on On Modules > Carecoordination on AWS Linux 2023

Situation
Have 7.0.2 running in EC2 on Amazon Linux 2023 with Apache, php-fpm, etc. Installed nvm and node based on Amazon article. nvm init and nvm install complete successfully in the ccdaservice directory. Carecoordination modules are registered and activated per setup guide.

When I access Modules > Carecoordination, it gives the 404 error below. In the /var/log/php-fpm/www-error.log file, I see the message:
Connection failed. Node does not appear to be installed on the system.

I can run node serveccda.js in the ccdaservice folder and do not see any errors.

Further, I can run nvm and node as ec2-user, but not with sudo. I suspect there is some issue when OpenEMR is trying to launch the node app and can’t find the node executable, but I’m not sure of that.

OpenEMR Version
7.0.2

Browser:
I’m using: Chrome

Operating System
I’m using: Amazon Linux 2023

Search
Did you search the forum for similar questions?
Yes, there are some similar hits but not exactly this issue.

Logs
Did you check the logs?
Was there anything pertinent in them? Yes, included here.
Please paste them here (surround with three backticks (```) for readability.
You can also turn on User Debugging under Administration->Globals->Logging User Debugging Options=>All

An error occurred during execution; please try again later.
Additional information:
Exception
File:
/var/www/html/openemr/src/Cqm/CqmClient.php:43
Message:
Connection Failed.
Stack trace:
#0 /var/www/html/openemr/src/Common/Http/HttpClient.php(62): OpenEMR\Cqm\CqmClient->getCommand()
#1 /var/www/html/openemr/src/Services/Qrda/QrdaReportService.php(40): OpenEMR\Common\Http\HttpClient->start()
#2 /var/www/html/openemr/src/Cqm/QrdaControllers/QrdaReportController.php(27): OpenEMR\Services\Qrda\QrdaReportService->__construct()
#3 /var/www/html/openemr/interface/modules/zend_modules/module/Carecoordination/src/Carecoordination/Controller/EncountermanagerController.php(97): OpenEMR\Cqm\QrdaControllers\QrdaReportController->__construct()
#4 /var/www/html/openemr/vendor/laminas/laminas-mvc/src/Controller/AbstractActionController.php(72): Carecoordination\Controller\EncountermanagerController->indexAction()
#5 /var/www/html/openemr/vendor/laminas/laminas-eventmanager/src/EventManager.php(320): Laminas\Mvc\Controller\AbstractActionController->onDispatch()
#6 /var/www/html/openemr/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#7 /var/www/html/openemr/vendor/laminas/laminas-mvc/src/Controller/AbstractController.php(105): Laminas\EventManager\EventManager->triggerEventUntil()
#8 /var/www/html/openemr/vendor/laminas/laminas-mvc/src/DispatchListener.php(117): Laminas\Mvc\Controller\AbstractController->dispatch()
#9 /var/www/html/openemr/vendor/laminas/laminas-eventmanager/src/EventManager.php(320): Laminas\Mvc\DispatchListener->onDispatch()
#10 /var/www/html/openemr/vendor/laminas/laminas-eventmanager/src/EventManager.php(178): Laminas\EventManager\EventManager->triggerListeners()
#11 /var/www/html/openemr/vendor/laminas/laminas-mvc/src/Application.php(319): Laminas\EventManager\EventManager->triggerEventUntil()
#12 /var/www/html/openemr/src/Core/ModulesApplication.php(168): Laminas\Mvc\Application->run()
#13 /var/www/html/openemr/interface/modules/zend_modules/public/index.php(59): OpenEMR\Core\ModulesApplication->run()
#14 {main}

Add node or nodejs whichever it may be to you environment path.
This says it all:
protected function getCommand(): string
{
$port = $this->port;

    $node = 'node';
    $cmd = $this->servicePath;

    if (IS_WINDOWS) {
        $cmd = "start /B $node $cmd";
        return $cmd;
    } else {
        $command = $node;
        $system = new System();
        if (!$system->command_exists($node)) {
            if ($system->command_exists('nodejs')) {
                $command = 'nodejs';
            } else {
                error_log("Connection failed. Node does not appear to be installed on the system.");
                throw new Exception('Connection Failed.');
            }
        }
        $node = $command;
    }

    return "$node $cmd";
}

Thanks. I was stumbling on trying to alter the path for apache when it was the path for php-fpm I needed to change!

For reference, I added the path to the node executable in ec2-user’s home directory to the env[PATH] setting in /etc/php-fpm.d/www.conf

1 Like

I meant to thank you for posting this issue because I’m sure this will come up again by folks implementing your environment type.

I you could mark the solution it will help the search engine direct folks.

1 Like