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

Well I do apologize about this. I ended up verifying what I copied over and removed the second ui folder that was showing. (not sure how this was the only duplicate) but now the code build and runs. Thank you and sorry once again.

No problem. Did you managed to reproduce the original error that caused the unhandled promise rejection?

it’s reproduceable just by letting it run currently, and yes it happened again.

Sep 18 12:10:09 acs genieacs-cwmp[7775]: (node:7786) UnhandledPromiseRejectionWarning: 
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
Sep 18 12:10:09 acs genieacs-cwmp[7775]:     at ServerResponse.setHeader 
(_http_outgoing.js:518:11)
Sep 18 12:10:09 acs genieacs-cwmp[7775]:     at ServerResponse.writeHead 
(_http_server.js:273:21)
Sep 18 12:10:09 acs genieacs-cwmp[7775]:     at /home/genieacs/genieacs/dist/bin/genieacs- 
cwmp:2:131043
Sep 18 12:10:09 acs genieacs-cwmp[7775]:     at runMicrotasks (<anonymous>)
Sep 18 12:10:09 acs genieacs-cwmp[7775]:     at processTicksAndRejections 
(internal/process/task_queues.js:97:5)
Sep 18 12:10:09 acs genieacs-cwmp[7775]: (node:7786) UnhandledPromiseRejectionWarning: 
Unhandled promise rejection. This error originated either by throwing inside of an async fu...

And verified I had a newer genieacs-cwmp.

./genieacs-cwmp
2020-09-18T19:10:54.966Z [INFO] genieacs-cwmp starting; pid=8290 
version="1.2.1+20200918180916"

I suspect you’re still running old code somehow. Please double check you have the latest code and that you restarted genieacs-cwmp after npm run build.

The unhandledRejection event is emitted whenever a promise rejection is not handled. “Rejection” is the canonical term for a promise reporting an error. As defined in ES6, a promise is a state machine representation of an asynchronous operation and can be in one of 3 states: “pending”, “fulfilled”, or “rejected”. Somebody decided that JavaScript programmers couldn’t be trusted with managing promise rejections properly and changed the HTML spec to require browsers to throw “unhandled promise rejection” errors if a rejected promise has no rejection handlers added before code returns to the event loop. The error usually happens in async await functions, and there’s an easy fix.

const functionName = async (arguments) => {
  try {
  // Your code here
  } catch (error) {
  // Handle rejection here
  }
};