fix: fix ATG startup
authorJérôme Benoit <jerome.benoit@sap.com>
Wed, 19 Jul 2023 16:19:28 +0000 (18:19 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Wed, 19 Jul 2023 16:19:28 +0000 (18:19 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package.json
src/charging-station/AutomaticTransactionGenerator.ts

index 736ab6dd2cd695e09681a3c1349703afb677b336..bed0de6096e0c2607686a83e8b04449df82b91f6 100644 (file)
@@ -55,7 +55,7 @@
     "preinstall": "node skip-preinstall.cjs || npx --yes only-allow pnpm",
     "prepare": "node prepare.cjs",
     "build-requirements": "node --no-warnings build-requirements.mjs",
-    "start": "pnpm build && cross-env NODE_ENV=production node -r source-map-support/register dist/start.js",
+    "start": "pnpm build && cross-env NODE_ENV=production node dist/start.js",
     "start:dev": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register dist/start.js",
     "start:dev:debug": "pnpm build:dev && cross-env NODE_ENV=development node -r source-map-support/register --inspect dist/start.js",
     "start:prof": "cross-env NODE_ENV=production node -r source-map-support/register --prof dist/start.js",
index 3e7f0716de721be39426ae363f8070e00e4d2b92..578f47e942d89e38c0700c3fec919b80bc750948 100644 (file)
@@ -347,9 +347,9 @@ export class AutomaticTransactionGenerator extends AsyncResource {
   }
 
   private getConnectorStatus(connectorId: number): Status {
-    const connectorStatus = cloneObject(
-      this.chargingStation.getAutomaticTransactionGeneratorStatuses()!,
-    )[connectorId];
+    const connectorStatus = this.chargingStation.getAutomaticTransactionGeneratorStatuses()
+      ? cloneObject(this.chargingStation.getAutomaticTransactionGeneratorStatuses()!)[connectorId]
+      : undefined;
     delete connectorStatus?.startDate;
     delete connectorStatus?.lastRunDate;
     delete connectorStatus?.stopDate;