Generator-jhipster: JHipster gae error

Created on 24 Apr 2019  路  29Comments  路  Source: jhipster/generator-jhipster

I'm trying to generate the configuration files for google app engine on a monolithic application in windows.

When I run the command "jhipster gae" it gives me this error:

Welcome to Google App Engine Generator (Beta)
WARNING! This sub-generator is still in development, please report bugs on Github

Installing App Engine Java SDK
... Running: gcloud components install app-engine-java --quiet
events.js:167
throw er; // Unhandled 'error' event
^

Error: spawn gcloud ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:238:12)
at onErrorNT (internal/child_process.js:407:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

JHipster Version(s)
[email protected] C:\Users\angel\Development\jhipster\jhipster-gcp
`-- [email protected]

##### **JHipster configuration, a `.yo-rc.json` file generated in the root folder**
.yo-rc.json file
{
  "generator-jhipster": {
    "promptValues": {
      "packageName": "com.angelchanquin.gcp.notifications"
    },
    "jhipsterVersion": "5.8.2",
    "applicationType": "monolith",
    "baseName": "gcp_example",
    "packageName": "com.angelchanquin.gcp.notifications",
    "packageFolder": "com/angelchanquin/gcp/notifications",
    "serverPort": "8080",
    "authenticationType": "jwt",
    "cacheProvider": "ehcache",
    "enableHibernateCache": true,
    "websocket": false,
    "databaseType": "sql",
    "devDatabaseType": "h2Disk",
    "prodDatabaseType": "mysql",
    "searchEngine": false,
    "messageBroker": false,
    "serviceDiscoveryType": false,
    "buildTool": "maven",
    "enableSwaggerCodegen": false,
    "jwtSecretKey": "",
    "clientFramework": "angularX",
    "useSass": false,
    "clientPackageManager": "npm",
    "testFrameworks": [],
    "jhiPrefix": "jhi",
    "entitySuffix": "",
    "dtoSuffix": "DTO",
    "otherModules": [],
    "enableTranslation": false
  }
}

JDL for the Entity configuration(s) entityName.json files generated in the .jhipster directory


JDL entity definitions

entity Notifications {
  title String required maxlength(20),
  message String required maxlength(100)
}
service Notifications with serviceClass

Environment and Tools

java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

git version 2.19.1.windows.1

node: v10.13.0

npm: 6.4.1

yeoman: 2.0.5

yarn: 1.12.3

Docker version 18.09.1, build 4c52b90

docker-compose version 1.23.2, build 1110ad01

  • [X] Checking this box is mandatory (this is just to show you read everything)
$$ bug-bounty $$ $100 area GCP

All 29 comments

Did you follow the documentation and install gcloud beforehand? It looks like the script couldn't find it. If you did, make sure it's in your PATH variable

Did you follow the documentation and install gcloud beforehand? It looks like the script couldn't find it. If you did, make sure it's in your PATH variable

Yes, I already installed it and its in my path!

@ruddell any other suggestion?

I don't have Windows or Google Cloud credit so I can't attempt to reproduce.

It might have to do with using child_process.spawn vs child_process.exec since exec seems to find gcloud, but the later call to spawn fails (code). That's the only place in JHipster's code that I see spawn used. spawn does not use a shell by default, whereas exec does.

I'm having the same problem. Thx

@Tonterias, can you try replacing spawn by exec in the generator code and see if it fixes the issue ?

Hi Pierre,

Where exactly do you want to make the replace?

Line 68? https://github.com/jhipster/generator-jhipster/blob/6de26d3a7019f4af2424fd5fad8d7312c98c1903/generators/gae/index.js#L62-L68

const child = spawn('gcloud', ['components', 'install', component, '--quiet'], {

It does not work, either!

D:\BasuraTemporal\Jhipster\jhv6betak8smvn>jhipster gae
INFO! Using JHipster version installed locally in current project's node_modules
INFO! Executing jhipster:gae
INFO! Options: from-cli: true
Welcome to Google App Engine Generator (Beta)
WARNING! This sub-generator is still in development, please report bugs on Github

Installing App Engine Java SDK
... Running: gcloud components install app-engine-java --quiet
events.js:174
throw er; // Unhandled 'error' event
^

Error: spawn gcloud ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
at onErrorNT (internal/child_process.js:415:16)
at process._tickCallback (internal/process/next_tick.js:63:19)

Thanks for your help
PD: Please, try to be as explicit as Jon.

A workaround is to run gcloud components install app-engine-java before running jhipster gae, which will skip the code section with spawn. According to @Tonterias there are other issues after that.

@devangelist Could you please try that and see if you can get it working?

@ruddell I already did the "gcloud components install app-engine-java" command and it fixes the issue I mentioned before but it gives me another issue. When I get to the "Google cloud SQL instance" selection it gives me:

{ Error: Command failed: gcloud sql instances list --format='valueseparator=":"' --project="jhipster-gae"
ERROR: (gcloud.sql.instances.list) Name expected [:(settings.userLabels:alias=labels:label=LABELS) table(name,databaseVersion,firstof(gceZone,region):label=LOCATION,settings.tier,ip_addresses.filter("type:PRIMARY").map(1).extract(ip_address).flatten().yesno(no="-"):label=PRIMARY_ADDRESS,ip_addresses.filter("type:PRIVATE").map(1).extract(ip_address).flatten().yesno(no="-"):label=PRIVATE_ADDRESS,state:label=STATUS) HERE 'valueseparator=:'].

at ChildProcess.exithandler (child_process.js:289:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

killed: false,
code: 1,
signal: null,
cmd:
'gcloud sql instances list --format=\'valueseparator=":"\' --project="jhipster-gae"' }

when its trying to get the cloud sql instances I already have. Then it gives me a choice to create a new one and when I select a new one this is the error:

{ Error: Command failed: gcloud sql instances create "gcp_example" --region='us-east1' --project=jhipster-gae
ERROR: (gcloud.sql.instances.create) argument INSTANCE: Bad value [gcp_example]: must be composed of lowercase letters, numbers, and hyphens; must start with a letter.
Usage: gcloud sql instances create INSTANCE [optional flags]
optional flags may be --activation-policy | --assign-ip | --async |
--authorized-gae-apps | --authorized-networks |
--availability-type | --backup | --backup-start-time |
--cpu | --database-flags | --database-version |
--enable-bin-log | --failover-replica-name |
--follow-gae-app | --gce-zone | --help |
--maintenance-release-channel |
--maintenance-window-day | --maintenance-window-hour |
--master-instance-name | --memory | --pricing-plan |
--region | --replica-type | --replication |
--require-ssl | --root-password |
--storage-auto-increase | --storage-size |
--storage-type | --tier | --zone

For detailed information on this command and its flags, run:
gcloud sql instances create --help

at ChildProcess.exithandler (child_process.js:289:12)
at ChildProcess.emit (events.js:182:13)
at maybeClose (internal/child_process.js:962:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

killed: false,
code: 2,
signal: null,
cmd:
'gcloud sql instances create "gcp_example" --region=\'us-east1\' --project=jhipster-gae' }

any ideas?

@PierreBesson +1

Anyone?

I gave a try to the sub generator gae and I confirm it's broken.
Some commands have changed and we need to update them.

@devangelist : your help is welcome here. Can you have a look at this file and try to fix the commands which are in error for you ? Or at least, if you can point us

Hi @jdubois,

Is there any idea about when this could be fixed? I mean no rush, just wonder when. I think it is pretty important for Google to have clients that can spend $s using Jhipster in GCP.

Thanks a lot!

@Tonterias : as it's an open source project, we can't give any date about the fix. It will be fixed when someone wants to spend time to investigate and to find a fix.

@pascalgrimaud Thanks. I wish I could do it. I just wanted to know if anyone was looking at it.

Yes please, go ahead @Tonterias !

I'm adding a bounty on this, as it's important to fix GAE sub generator

Hi all,

having the same issue, it seems that
gcloud sql instances list --format="value[separator=":"](project,region,name)"
works but not
gcloud sql instances list --format='value[separator=":"](project,region,name)'

==> I guess the format option value have to be specified with double quote

Hi all,

having the same issue, it seems that
gcloud sql instances list --format="value[separator=":"](project,region,name)"
works but not
gcloud sql instances list --format='value[separator=":"](project,region,name)'

==> I guess the format option value have to be specified with double quote

Sorry dpiraud, Where do you exactly make that change? I will reproduce the error and try it as soon as know where to change it. Thanks a lot.

Hi all,
having the same issue, it seems that
gcloud sql instances list --format="value[separator=":"](project,region,name)"
works but not
gcloud sql instances list --format='value[separator=":"](project,region,name)'
==> I guess the format option value have to be specified with double quote

Sorry dpiraud, Where do you exactly make that change? I will reproduce the error and try it as soon as know where to change it. Thanks a lot.

Please have a look in generator-jhipster/generators/gae/index.js.

Is this still a bug? I also can't seem to get my jhipster gae to work

@NoBadDays : yes, the issue is still opened, as we didn't find someone who wants to work on this

@PierreBesson @pascalgrimaud @Tonterias : I've created a pull request (https://github.com/jhipster/generator-jhipster/pull/10210) to fix both the issues/bugs (https://github.com/jhipster/generator-jhipster/issues/9605#issue-436446199 and https://github.com/jhipster/generator-jhipster/issues/9605#issuecomment-486873738) highlighted in this thread.

I feel that there's cases that are not handled in this generator. Such as it forces to create a Cloud SQL instance which I think should be a choice that should be made by the user. I will create appropriate issues for these in the future.

Please let me know if there's any further issues with this generator. 馃槃

@SudharakaP : thanks a lot ! not sure I'll have the time to test and review. Hope someone else from the team can do it

@pascalgrimaud : You are welcome 馃槃 . Also I want to mention that I made a tiny improvement while I am doing this. Previously there is this case where if you have app-engine-java installed but not updated to the most recent version, you'll get an error because of the way we check whether it's installed or not. In the new scheme of things, if you have it installed, even if it's not the most up to date version, the generator will proceed. I believe some people might have got the original error mentioned in the thread not because app-engine-java was not installed, but they have an older version. Anyways, this is fixed now so ideally you don't have to run things such as gcloud components install app-engine-java or gcloud components update etc.

@SudharakaP : don't forget to claim the bounty here too :)

@pascalgrimaud : Thanks much; claim submitted at https://opencollective.com/generator-jhipster/expenses/10081 :smile:

This problem has come back, just edited in the file and works

solution of @dpiraud

Hi all,
having the same issue, it seems that
gcloud sql instances list --format="valueseparator=":""
works but not
gcloud sql instances list --format='valueseparator=":"'
==> I guess the format option value have to be specified with double quote

then comes another error

脳 ERROR: (gcloud.sql.databases.list) Name expected [ table( name, charset, collation ) *HERE* 'value(name)'].

@sgpalit : This is a very old issue. If you still encounter any issues I suggest opening a new issue with full details (please complete the issue template so that we have more info). 馃槃

Was this page helpful?
0 / 5 - 0 ratings