sap-labs-france / ev-server

The Open e-Mobility Charging Station management backend server (check also ev-dashboard and ev-mobile)
https://open-e-mobility.fr/
Apache License 2.0
154 stars 144 forks source link

TransactionStorage Error #3397

Closed aliuysal60 closed 2 years ago

aliuysal60 commented 2 years ago

Hi, This project is super, I want to develop and use it for the first time, but I couldn't run it. Why am I getting the following error? My mongo level is very low. Could this be the reason? Can you help me?

ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts
./src/storage/mongodb/TransactionStorage.ts 312:39-313:15
[tsl] ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts(312,40)
      TS2615: Type of property 'chargingStations' circularly references itself in mapped type '{ [Key in keyof SiteArea]: SiteArea[Key] extends SiteArea ? [Key] : SiteArea extends SiteArea[Key] ? [Key] : SiteArea[Key] extends readonly (infer ArrayType)[] ? SiteArea extends ArrayType ? [...] : ArrayType extends SiteArea ? [...] : [...] : [...]; }'.
 @ ./src/async-task/tasks/BillTransactionAsyncTask.ts 13:53-104
 @ ./src/async-task/AsyncTaskManager.ts 7:59-102
 @ ./src/start.ts 6:51-91

ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts
./src/storage/mongodb/TransactionStorage.ts 312:39-313:15
[tsl] ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts(312,40)
      TS2615: Type of property 'site' circularly references itself in mapped type '{ id: ["id"]; name: ["name"]; address: ["address", "coordinates", number] | ["address", "address1"] | ["address", "address2"] | ["address", "postalCode"] | ["address", "city"] | [...] | [...] | [...]; ... 33 more ...; canReadChargingStations: [...]; }'.
 @ ./src/async-task/tasks/BillTransactionAsyncTask.ts 13:53-104
 @ ./src/async-task/AsyncTaskManager.ts 7:59-102
 @ ./src/start.ts 6:51-91

ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts
./src/storage/mongodb/TransactionStorage.ts 312:39-313:15
[tsl] ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts(312,40)
      TS2615: Type of property 'siteArea' circularly references itself in mapped type '{ id: ["id"]; createdBy: ["createdBy"]; createdOn: ["createdOn"]; lastChangedBy: ["lastChangedBy"]; lastChangedOn: ["lastChangedOn"]; coordinates: ["coordinates", number]; issuer: ["issuer"]; ... 56 more ...; oicpData: [...] | ... 59 more ... | [...]; }'.
 @ ./src/async-task/tasks/BillTransactionAsyncTask.ts 13:53-104
 @ ./src/async-task/AsyncTaskManager.ts 7:59-102
 @ ./src/start.ts 6:51-91

ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts
./src/storage/mongodb/TransactionStorage.ts 312:39-313:15
[tsl] ERROR in D:\ev-server\src\storage\mongodb\TransactionStorage.ts(312,40)
      TS2615: Type of property 'siteAreas' circularly references itself in mapped type '{ [Key in keyof Site]: Site[Key] extends Site ? [Key] : Site extends Site[Key] ? [Key] : Site[Key] extends readonly (infer ArrayType)[] ? Site extends ArrayType ? [...] : ArrayType extends Site ? [...] : [...] : [...]; }'.
 @ ./src/async-task/tasks/BillTransactionAsyncTask.ts 13:53-104
 @ ./src/async-task/AsyncTaskManager.ts 7:59-102
 @ ./src/start.ts 6:51-91

image

github-actions[bot] commented 2 years ago

Welcome to your first issue in e-Mobility software

LucasBrazi06 commented 2 years ago

Thanks! What version of MongoDB are you using? We currently use 4.4.

aliuysal60 commented 2 years ago

Yes, my Mongo version is 4.4.1 I follow all the instructions exactly, I don't get any errors, I create the relevant DB users. Then I edited the config.json and when I run the command "npm run start" I get this error.

Is it necessary to create a database named evse in MongoDB? I do not have. How should I do?

image

aliuysal60 commented 2 years ago

my config.json;

{
  "EVDatabase": {
    "url": "",
    "key": ""
  },
  "Crypto": {
    "key": "",
    "algorithm": ""
  },
  "CentralSystems": [
    {
      "type": "ocpp",
      "implementation": "soap",
      "protocol": "http",
      "host": "localhost",
      "port": 8000,
      "debug": false
    },
    {
      "type": "ocpp",
      "implementation": "json",
      "protocol": "ws",
      "host": "localhost",
      "port": 8010,
      "keepaliveinterval": 30,
      "debug": false
    }
  ],
  "CentralSystemRestService": {
    "protocol": "http",
    "host": "localhost",
    "port": 80,
    "userTokenKey": "myKey",
    "userTokenLifetimeHours": 12,
    "userDemoTokenLifetimeDays": 365,
    "userTechnicalTokenLifetimeDays": 365,
    "passwordWrongNumberOfTrial": 3,
    "passwordBlockedWaitTimeMin": 5,
    "captchaSecretKey": "myKey",
    "captchaScore": 0.25,
    "debug": false
  },
  "CentralSystemFrontEnd": {
    "protocol": "http",
    "host": "localhost",
    "port": 80
  },
  "OCPIService": {
    "protocol": "http",
    "host": "localhost",
    "port": 9090,
    "debug": false
  },
  "OICPService": {
    "protocol": "http",
    "host": "localhost",
    "port": 9080,
    "debug": false
  },
  "CentralSystemServer": {
    "protocol": "http",
    "host": "localhost",
    "port": 80
  },
  "ODataService": {
    "protocol": "http",
    "host": "localhost",
    "port": 9292,
    "debug": false
  },
  "WSDLEndpoint": {
    "baseSecureUrl": ""
  },
  "JsonEndpoint": {
    "baseSecureUrl": ""
  },
  "OCPIEndpoint": {
    "baseUrl": ""
  },
  "AsyncTask": {
    "active": true,
    "nbrTasksInParallel": 4
  },
  "Storage": {
    "implementation": "mongodb",
    "host": "localhost",
    "port": 27017,
    "user": "evse-user",
    "password": "123456",
    "database" : "evse"
  },
  "Notification": {
    "Email": {
      "enabled": true
    },
    "RemotePushNotification": {
      "enabled": true
    }
  },
  "Firebase": {
    "type": "",
    "projectID": "",
    "privateKeyID": "",
    "privateKey": "",
    "clientEmail": "",
    "clientID": "",
    "authURI": "",
    "tokenURI": "",
    "authProviderX509CertURL": "",
    "clientX509CertURL": "",
    "databaseURL": ""
  },
  "Axios": {
    "retries": 0,
    "timeoutSecs": 30
  },
  "Email": {
    "disableBackup": false,
    "smtp": {
      "from": "",
      "host": "",
      "port": 465,
      "secure": true,
      "requireTLS": false,
      "user": "",
      "password": ""
    },
    "smtpBackup": {
      "from": "",
      "host": "",
      "port": 465,
      "secure": true,
      "requireTLS": false,
      "user": "",
      "password": ""
    }
  },
  "Authorization": {
    "debug": false
  },
  "ChargingStation": {
    "heartbeatIntervalOCPPSSecs": 60,
    "heartbeatIntervalOCPPJSecs": 3600,
    "pingIntervalOCPPJSecs": 60,
    "monitoringIntervalOCPPJSecs": 600,
    "notifBeforeEndOfChargeEnabled": true,
    "notifBeforeEndOfChargePercent": 85,
    "notifEndOfChargeEnabled": true,
    "notifStopTransactionAndUnlockConnector": false,
    "maxLastSeenIntervalSecs": 540
  },
  "Migration": {
    "active": true
  },
  "Scheduler": {
    "active": false,
    "tasks": [
      {
        "name": "OICPPushEVSEDataTask",
        "active": false,
        "periodicity": "*/10 * * * *",
        "config": {
          "processAllEVSEs": true
        }
      },
      {
        "name": "OICPPushEvseStatusTask",
        "active": false,
        "periodicity": "*/5 * * * *",
        "config": {
          "processAllEVSEs": true
        }
      }
    ]
  },
  "Trace": {
    "traceIngressHttp": false,
    "traceEgressHttp": false,
    "traceOcpp": false,
    "traceDatabase": false,
    "traceNotification": false
  },
  "Logging": {
    "logLevel": "D"
  }
}

image

cemilakkoc commented 2 years ago

Thanks! What version of MongoDB are you using? We currently use 4.4.

Mine is also 4.4 and i get the exact same errors.

LucasBrazi06 commented 2 years ago

Is it necessary to create a database named evse in MongoDB? I do not have. How should I do?

No the DB and Collections are created on the fly. I'll check and let you know.

LucasBrazi06 commented 2 years ago

It seems the stack trace is not corresponding to the source code. What branch do you use? What OS? Linux?

aliuysal60 commented 2 years ago

It seems the stack trace is not corresponding to the source code. What branch do you use? What OS? Linux?

Hi, master-qa

I have run it on windows and Ubuntu. both gave the same error.

cemilakkoc commented 2 years ago

It seems the stack trace is not corresponding to the source code. What branch do you use? What OS? Linux?

master-qa macOS Monterey 12.2.1

LucasBrazi06 commented 2 years ago

I just cloned it, performed 'npm install', created the config.json with your data and it compiled successfully and failed at runtime with a missing props in the config file:

image

Did you use NodeJs V16?

aliuysal60 commented 2 years ago

Ben sadece onu klonladım, 'npm kurulumunu' gerçekleştirdim, verilerinizle config.json'u yarattım ve config dosyasında eksik bir sahne ile çalışma zamanında başarılı bir şekilde derlendi ve başarısız oldu: resim

NodeJs V16 kullandınız mı?

Me too get this error when I run "debug:dev", but when I run "npm start" it gives the error I mentioned above. very strange, I set up many virtual servers and tried again and again, always the same error

image

Yes nodeJs v16

{
  'ev-server': '2.6.2',
  npm: '6.14.4',
  ares: '1.18.1',
  brotli: '1.0.9',
  cldr: '40.0',
  icu: '70.1',
  llhttp: '6.0.4',
  modules: '93',
  napi: '8',
  nghttp2: '1.45.1',
  nghttp3: '0.1.0-DEV',
  ngtcp2: '0.1.0-DEV',
  node: '16.14.0',
  openssl: '1.1.1m+quic',
  tz: '2021a3',
  unicode: '14.0',
  uv: '1.43.0',
  v8: '9.4.146.24-node.20',
  zlib: '1.2.11'
}
LucasBrazi06 commented 2 years ago

You have the wrong npm version.

{
  'ev-server': '2.6.3',
  npm: '8.1.0',
  node: '16.13.0',
  v8: '9.4.146.19-node.13',
  uv: '1.42.0',
  zlib: '1.2.11',
  brotli: '1.0.9',
  ares: '1.17.2',
  modules: '93',
  nghttp2: '1.45.1',
  napi: '8',
  llhttp: '6.0.4',
  openssl: '1.1.1l+quic',
  cldr: '39.0',
  icu: '69.1',
  tz: '2021a',
  unicode: '13.0',
  ngtcp2: '0.1.0-DEV',
  nghttp3: '0.1.0-DEV'
}
LucasBrazi06 commented 2 years ago

Me too get this error when I run "debug:dev", but when I run "npm start" it gives the error I mentioned above. very strange, I set up many virtual servers and tried again and again, always the same error

image

The file config.json is validated against a Json schema and you have an error in it. Check the Json schema: /ev-server/src/assets/schemas/configuration/configuration.json

aliuysal60 commented 2 years ago

Me too get this error when I run "debug:dev", but when I run "npm start" it gives the error I mentioned above. very strange, I set up many virtual servers and tried again and again, always the same error

Which version should it be?

image

The file config.json is validated against a Json schema and you have an error in it. Check the Json schema: /ev-server/src/assets/schemas/configuration/configuration.json

ok i fixed it it crashed again same error

image

aliuysal60 commented 2 years ago

@LucasBrazi06 very thanks for your help. In npm version 8.5.2 these errors are fixed. But the following came :)

04.03.2022 21:29:22 - e-Mobility Server is starting...
04.03.2022 21:29:22 - NodeJS is started in 'production' mode
Missing property 'Monitoring' in config.json
04.03.2022 21:29:22 - Connecting to the Database...
04.03.2022 21:29:22 - Connecting to 'mongodb'...
04.03.2022 21:29:22 - TypeError: Cannot read properties of undefined (reading 'toString')
LucasBrazi06 commented 2 years ago

You can ignore the missing property and you have to debug the null pointer ;-). Either check the logs in the DB (default.logs) or put a breakpoint in VSCode.

aliuysal60 commented 2 years ago

@LucasBrazi06 thanks, now working

dignitech-rakesh commented 2 years ago

I am trying to run this on Node 16.14.0, NPM 8.3.1 and MongoDB 4.4.13, but I am facing the same error.

Screenshot 2022-03-08 at 7 44 35 PM Screenshot 2022-03-08 at 7 44 53 PM

Please advise.

aliuysal60 commented 2 years ago

Bunu Düğüm 16.14.0, NPM 8.3.1 ve MongoDB 4.4.13 üzerinde çalıştırmaya çalışıyorum ama aynı hatayla karşı karşıyayım. Ekran Görüntüsü 2022-03-08, 7 44 35 PM Ekran Görüntüsü 2022-03-08, 7 44 53 PM

Tavsiye lütfen.

Hello, You cannot do the "authorization" specified in the "README" with 4.4.13. Try using 4.4.0. Make sure you have done the exact "replica set" and other settings. Also, add the mongodb parameters in the config.json file like this, it's causing problems when there is no url.

"Storage": {
    "implementation": "mongodb",
    "uri": "mongodb://evse-user:your_password@your_host:27017/evse?readPreference=secondaryPreferred",
    "host": "your_host",
    "port": 27017,
    "user": "evse-user",
    "password": "your_password",
    "database" : "evse",
    "replicaSet": "rs0",
    "poolSize": 200
  },

image