Error with 1.2.0 & genieacs-cwmp (Unhandled Promise Rejection Warning)

I recently moved a bunch of CPE over to GenieACS (latest pulled from github), their inform interval is set for 3600 seconds but I have not recieved another inform since 12:31:44pm yesterday. I checked the services and they are all running but found this error was spit out by genieacs-cwmp.

Sep 15 12:31:44 acs genieacs-cwmp[977]: (node:1078) UnhandledPromiseRejectionWarning: Error 
[ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Sep 15 12:31:44 acs genieacs-cwmp[977]:     at ServerResponse.setHeader 
(_http_outgoing.js:518:11)
Sep 15 12:31:44 acs genieacs-cwmp[977]:     at ServerResponse.writeHead (_http_server.js:273:21)
Sep 15 12:31:44 acs genieacs-cwmp[977]:     at /home/genieacs/genieacs/dist/bin/genieacs- 
cwmp:2:131004
Sep 15 12:31:44 acs genieacs-cwmp[977]:     at runMicrotasks (<anonymous>)
Sep 15 12:31:44 acs genieacs-cwmp[977]:     at processTicksAndRejections 
(internal/process/task_queues.js:97:5)
Sep 15 12:31:44 acs genieacs-cwmp[977]: (node:1078) UnhandledPromiseRejectionWarning: 
Unhandled promise rejection. This error originated either by throwing inside of an async function 
without a catch block, or by rejecting a promise whic...

Your title and the body of your message are not consistent. Did you pull the v1.2.0 tag, or did you pull latest? There have been several fixes since v1.2.0.

If you are running v1.2.0, I suggest you update to master.

Ah yes, I should’ve checked github first. I apologize. It looks like I am running a copy from Sept 9th from github and I see recent fixes.

Are you still getting this error after updating?

I have updated from the latest master on github and let it run for a bit. Came back from lunch and saw this error again.

Sep 16 12:34:13 acs genieacs-cwmp[22406]: (node:23530) UnhandledPromiseRejectionWarning: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Sep 16 12:34:13 acs genieacs-cwmp[22406]:     at ServerResponse.setHeader (_http_outgoing.js:518:11)
Sep 16 12:34:13 acs genieacs-cwmp[22406]:     at ServerResponse.writeHead (_http_server.js:273:21)
Sep 16 12:34:13 acs genieacs-cwmp[22406]:     at /home/genieacs/genieacs/dist/bin/genieacs-cwmp:2:131043
Sep 16 12:34:13 acs genieacs-cwmp[22406]:     at runMicrotasks (<anonymous>)
Sep 16 12:34:13 acs genieacs-cwmp[22406]:     at processTicksAndRejections (internal/process/task_queues.js:97:5)
Sep 16 12:34:13 acs genieacs-cwmp[22406]: (node:23530) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 20)

Are you sure you’re running the most up to date version? As of 1.2.1 unhandled promise rejections should never occur. You should get a regular exception instead.

I double checked everything and can confirm that I am running 1.2.1.

When I run it manually instead of starting from systemd

root@acs:/home/genieacs/genieacs# /home/genieacs/genieacs/dist/bin/genieacs-cwmp
2020-09-17T04:32:28.746Z [INFO] genieacs-cwmp starting; pid=2074 version="1.2.1+20200916172228"

I also modified the systemd file on my previous install to point to this location.

[Service]
User=genieacs
EnvironmentFile=/home/genieacs/genieacs/genieacs.env
ExecStart=/home/genieacs/genieacs/dist/bin/genieacs-cwmp

The same with genie-ui. A lot of “UnhandledPromiseRejectionWarning: Unhandled promise rejection.”
version=“1.2.1+20200909044125” from npm

log part for ex.
Sep 17 14:39:03 shelter genieacs-ui[2974]: (node:2986) UnhandledPromiseRejectionWarning: TypeError: this.exprSynths.map(...).flat is not a function
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at Dt.true (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:39324)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at xt.true (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:40137)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at Ut (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:48240)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at Ft (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:49952)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at Ht (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:50312)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at mn.get (/usr/local/lib/node_modules/genieacs/bin/genieacs-ui:2:77550)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at dispatch (/usr/local/lib/node_modules/genieacs/node_modules/koa-compose/index.js:42:32)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at /usr/local/lib/node_modules/genieacs/node_modules/koa-router/lib/router.js:372:16
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at dispatch (/usr/local/lib/node_modules/genieacs/node_modules/koa-compose/index.js:42:32)
Sep 17 14:39:03 shelter genieacs-ui[2974]:     at /usr/local/lib/node_modules/genieacs/node_modules/koa-compose/index.js:34:12
Sep 17 14:39:03 shelter genieacs-ui[2974]: (node:2986) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 4)

So I was wrong when I assumed the linter rule that I added recently to guard against unhandled promise rejections covers every possible case. @tripout, just fixed this edge case so please update from git master and try again.

@npoxBocT, you’ll just need to upgrade your Node.js to 12 or 14.

oh. @zaidka thank u. solved

@zaidka I downloaded the latest master zip from github, ran npm install and upon running npm run build i get the following error.

> genieacs@1.2.1 build /home/genieacs/genieacs
> node -r esm -r ts-node/register/transpile-only build/build

Error: @rollup/plugin-typescript TS2717: Subsequent property declarations must have the same 
type.  Property 'authorizer' must be of type 'Authorizer', but here has type 'Authorizer'.
at error (/home/genieacs/genieacs/node_modules/rollup/dist/shared/rollup.js:5212:30)
at throwPluginError (/home/genieacs/genieacs/node_modules/rollup/dist/shared/rollup.js:17798:12)
at Object.error (/home/genieacs/genieacs/node_modules/rollup/dist/shared/rollup.js:18417:24)
at emitDiagnostic (/home/genieacs/genieacs/node_modules/@rollup/plugin- 
typescript/dist/index.js:415:17)
at reportDiagnostics (/home/genieacs/genieacs/node_modules/@rollup/plugin- 
typescript/dist/index.js:423:9)
at Array.forEach (<anonymous>)
at emitFilesAndReportErrors 
(/home/genieacs/genieacs/node_modules/typescript/lib/typescript.js:108219:21)
at Object.result.afterProgramCreate 
(/home/genieacs/genieacs/node_modules/typescript/lib/typescript.js:108390:13)
at Object.afterProgramCreate (/home/genieacs/genieacs/node_modules/@rollup/plugin- 
typescript/dist/index.js:515:29)
at synchronizeProgram 
(/home/genieacs/genieacs/node_modules/typescript/lib/typescript.js:108654:22)

This is odd. What version of Node are you using?

root@acs:/home/genieacs/genieacs# node --version
v12.18.3
root@acs:/home/genieacs/genieacs#

Version 12.18.3.

Can you run the following command and share the result: npm ls --depth 0

Here are the results;

That’s identical to what I got. Can you confirm no changes have been made to the code?

I can confirm I’ve not made any changes to the code, I download the master from github, copy it over to the proper folder, run the npm install and npm run build command.

I’m clueless here. Need to give this some thought. Maybe run npm run lint to see if you get any errors or warnings?

I do get a couple errors showing up in ui/ui/app.ts here is the pastebin from the part where it starts to error.

ui/ui/app.ts

There should not be such file. Looks like you have another copy of the project under ui directory…