Http secure failing on 1.2.9 version Getting Invalid certificate: yt.X509Certificate is not a constructor

I have enabled Http secure on 1.2.9 release.

Generated self signed certificates.

  1. set the following options in /opt/genieacs/genieacs.env
    GENIEACS_UI_SSL_CERT=/opt/genieacs/server.crt
    GENIEACS_UI_SSL_KEY=/opt/genieacs/server.key

given the full permission using chmod and chown

  1. Restarted the genieacs-ui service
    sudo systemctl restart genieacs-ui

  2. Getting the following error
    genieacs-ui[43291]: 2024-03-13T23:47:47.495Z [ERROR] Uncaught exception; pid=43291 exceptionName=“Error” exceptionMessage=“Invalid certificate: yt.X509Certificate is not a constructor” exceptionStack=“Error: Invalid certificate: yt.X509Certificate is not a constructor\n at /home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6649\n → /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:90:13\n at Array.map ()\n at ti (/home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6499)\n → /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:81:27\n at Kr (/home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6957)\n → /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:120:13\n at /home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:101:824\n → /home/lchand/Projects/ACS/GeneieACS/genieacs/bin/genieacs-ui.ts:88:14\n at processTicksAndRejections (internal/process/task_queues.js:97:5)”
    Mar 14 05:17:47 lchand genieacs-ui[42935]: 2024-03-13T23:47:47.608Z [ERROR] Worker died; pid=43291 exitCode=0

Is http secure working on release 1.2.9 ?

Regards
L. Chand

Yes, if you configure everything correctly.

Where did you put the generated crt and key files? Does the name and path match exactly to what is in GENIEACS_UI_SSL_CERT and GENIEACS_UI_SSL_KEY?

Thanks for your early response.

I generated self signed certificates using the following commands
openssl genrsa -out server.key 2048

openssl req -new -key server.key -out server.csr

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

openssl x509 -in server.crt -text -noout

iles permission:

From folder /home/lchand/Projects/ACS/GeneieACS/genieacs

-rwxrwxrwx 1 root genieacs 1.3K Mar 15 11:48 server.crt

-rwxrwxrwx 1 root genieacs 1.1K Mar 15 11:47 server.csr

-rwxrwxrwx 1 root genieacs 1.7K Mar 15 11:46 server.key

GENIEACS_UI_SSL_CERT=/home/lchand/Projects/ACS/GeneieACS/genieacs/server.crt

GENIEACS_UI_SSL_KEY=/home/lchand/Projects/ACS/GeneieACS/genieacs/server.key

restarting

sudo systemctl restart genieacs-ui

sudo systemctl status genieacs-ui

[sudo] password for lchand:

`genieacs-ui.service

  • GenieACS UI`

Loaded: loaded (/etc/systemd/system/genieacs-ui.service; enabled; vendor preset: enabled)

Active: failed (Result: exit-code) since Fri 2024-03-15 14:13:57 IST; 51min ago

Process: 22420 ExecStart=/home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui (code=exited, status=1/FAILURE)

Main PID: 22420 (code=exited, status=1/FAILURE)

From syslog, getting errors as
Mar 15 15:07:50 lchand genieacs-ui[24459]: 2024-03-15T09:37:50.295Z [ERROR] Uncaught exception; pid=24459 exceptionName="Error" exceptionMessage="Invalid certificate: yt.X509Certificate is not a constructor" exceptionStack="Error: Invalid certificate: yt.X509Certificate is not a constructor\n at /home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6649\n -> /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:90:13\n at Array.map (<anonymous>)\n at ti (/home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6499)\n -> /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:81:27\n at Kr (/home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:2:6957)\n -> /home/lchand/Projects/ACS/GeneieACS/genieacs/lib/server.ts:120:13\n at /home/lchand/Projects/ACS/GeneieACS/genieacs/dist/bin/genieacs-ui:101:824\n -> /home/lchand/Projects/ACS/GeneieACS/genieacs/bin/genieacs-ui.ts:88:14\n at processTicksAndRejections (internal/process/task_queues.js:97:5)"

Please suggest, what i can do to resolve this issue.

Regards
L Chand

What version of Nodejs are you using?

Nodejs version is v21.6.2

I couldn’t reproduce the issue on that version of Nodejs, but I could on Nodejs 12. Please double check which version of Nodejs the service is running under. It’s possible you may have multiple versions installed on your system.

Thank you zaidka.

It was the issue with nodejs only, I have latest nodejs i.e 21 version and also older one 12 version. This was causing the problem. Now i removed 12 version and
With self signed certificates, https is working properly.

Regards
L. Chand