jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.56k stars 4.02k forks source link

[Sub-generator Docker-compose] TypeError: Cannot convert undefined or null to object #7245

Closed ymarec closed 6 years ago

ymarec commented 6 years ago
Overview of the issue

When I run the docker-compose subgenerator, for a microservice application and a JHipster gateway, I get the following error and the docker-compose file is not generated :

Checking Docker images in applications' directories... events.js:183 throw er; // Unhandled 'error' event ^

TypeError: Cannot convert undefined or null to object at appsFolders.forEach (/home/jhipster/.config/yarn/global/node_modules/generator-jhipster/generators/docker-compose/index.js:179:25) at Array.forEach () at module.exports.setAppsYaml (/home/jhipster/.config/yarn/global/node_modules/generator-jhipster/generators/docker-compose/index.js:134:34) at Object. (/home/jhipster/.config/yarn/global/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:399:25) at /home/jhipster/.config/yarn/global/node_modules/generator-jhipster/node_modules/run-async/index.js:25:25 at new Promise () at /home/jhipster/.config/yarn/global/node_modules/generator-jhipster/node_modules/run-async/index.js:24:19 at self.env.runLoop.add.completed (/home/jhipster/.config/yarn/global/node_modules/generator-jhipster/node_modules/yeoman-generator/lib/index.js:400:11) at runCallback (timers.js:789:20) at tryOnImmediate (timers.js:751:5)

Reproduce the error

By creating a microservice and a gateway with all the default choices, the generator works. Here are the results of jhipster info for my microservice and my gateway for which the error occurs:

Microservice
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "cnom.activite"
    },
    "jhipsterVersion": "4.13.3",
    "baseName": "Activite",
    "packageName": "cnom.activite",
    "packageFolder": "cnom/activite",
    "serverPort": "8081",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mssql",
    "prodDatabaseType": "mssql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "replaced-by-jhipster-info",
    "enableTranslation": false,
    "applicationType": "microservice",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "clientPackageManager": "yarn",
    "skipClient": true,
    "skipUserManagement": true
  }
}
JDL entity definitions
entity Activite (activite) {
  numeroRPPS String maxlength(10),
  dateDebut LocalDate required,
  dateFin LocalDate,
  lieuExerciceId Long,
  dateMAJ Instant required,
  personneId Long required
}
service Activite with serviceImpl
microservice Activite with Activite
Gateway
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.cnom.ordinal.ui"
    },
    "jhipsterVersion": "4.13.3",
    "baseName": "OrdinalInterface",
    "packageName": "com.cnom.ordinal.ui",
    "packageFolder": "com/cnom/ordinal/ui",
    "serverPort": "8080",
    "authenticationType": "oauth2",
    "cacheProvider": "hazelcast",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "mssql",
    "prodDatabaseType": "mssql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": "eureka",
    "buildTool": "maven",
    "enableSocialSignIn": false,
    "enableSwaggerCodegen": false,
    "clientFramework": "angularX",
    "useSass": true,
    "clientPackageManager": "yarn",
    "applicationType": "gateway",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "enableTranslation": false
  }
}
JDL entity definitions
entity Personne (personne) {
  numeroRPPS String maxlength(11),
  nom String maxlength(80),
  nomNaissance String required maxlength(80),
  nomEpouse String maxlength(50),
  prenom String required maxlength(40),
  civilite String required maxlength(1),
  dateNaissance LocalDate required,
  paysNaissanceId Long required,
  communeNaissanceId Long,
  lieuNaissance String maxlength(11),
  dateDeces LocalDate,
  dateMAJ Instant required,
  dateCreation Instant required
}
entity PrenomComplementaire (prenom_complementaire) {
  prenom String required maxlength(30),
  ordre Integer required
}

relationship OneToMany {
  Personne{prenomComplementaire} to PrenomComplementaire{personne}
}

service Personne, PrenomComplementaire with serviceImpl

JHipster Version(s)

I am using a docker container : jhipster/jhipster:v4.14.1.

Environment and Tools openjdk version "1.8.0_151" OpenJDK Runtime Environment (build 1.8.0_151-8u151-b12-0ubuntu0.16.04.2-b12) OpenJDK 64-Bit Server VM (build 25.151-b12, mixed mode) git version 2.7.4 node: v8.9.4 npm: 5.6.0 bower: 1.8.2 gulp: [10:31:43] CLI version 2.0.1 yeoman: 2.0.1 yarn: 1.5.1

jdubois commented 6 years ago

I just tested it with our master branch and had no issue at all... And we didn't change this page this the last 4.x release... On the failing line we're doing a this.adminPassword to get the JHipster Registry password -> maybe that's the issue, are you sure you have a password?

jdubois commented 6 years ago

Once you have deployed you'll have database access error - this is because you use MS SQL Server, and the database schema isn't correctly configured. I'll have a look, but help is welcome if you have time and want to help.

jdubois commented 6 years ago

I really can't reproduce on our master branch, everything works fine, so I'm closing this. Maybe this was solved by moving to JHipster 5. For the SQL Server issue, I have solved it -> I'm going to open a specific ticket for this, and link it here