3
votes

First of all I know that http 502 on gcloud means any possible error. Also, in logs there are no errors only standard spring boot info and debug messages.

The project I have troubles is a swagger generated spring boot java project (more than 160 java files).

Locally on intellij works well and fast.

After executing mvn clean spring-boot:run on gclod shell the project starts and I see the default generated page on the browser.

After executing mvn appengine:deploy on gclod shell I always see this message on the browser: Error: Server Error The server encountered a temporary error and could not complete your request. Please try again in 30 seconds or This error: 502 Bad Gateway nginx. Always.

This are the last messages from gcloud console (after mvn appengine:deploy):

..done.
[INFO] GCLOUD: Setting traffic split for service [default]...
[INFO] GCLOUD: ...................................done.
[INFO] GCLOUD: Deployed service [default] to [https://polishapi-psd2.appspot.com]
[INFO] GCLOUD:
[INFO] GCLOUD: You can stream logs from the command line by running:
[INFO] GCLOUD:   $ gcloud app logs tail -s default
[INFO] GCLOUD:
[INFO] GCLOUD: To view your application in the web browser run:
[INFO] GCLOUD:   $ gcloud app browse
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  16:07 min
[INFO] Finished at: 2019-12-18T14:11:30+01:00
[INFO] ------------------------------------------------------------------------
C:\workspace\PolishAPI-psd2>gcloud app logs tail

In logs there are no errors. A basic, super simple, spring boot "hello world" project works but not that swagger generated big one.

How to deal with this problem? Thank you.

3
Hi, I'm from GCP Support. I saw that you have now a working Swagger app; is the issue solved, then?asbovelw
YES YES YES! :) without changing source code I discovered that this two lines in app.yaml file are enought: runtime: ` runtime: java11 instance_class: F4 `Piotr
I'm glad you solved your issue! :Dasbovelw
I still don't understand why only java11 runtime and standard environment works, but java and flex environment doesn't. In google docs there are no explanation. So,the issue is not solved , I used only a workaround.Piotr
3/3-Additionally, these links (Choosing Env, Key differences, Migrating) point out the differences between flexible and standard environment, so I figured out they might be helpful as well.Artemis Georgakopoulou

3 Answers

1
votes

After dealing with this problem for more than 4 weeks I discovered that the app.yaml file should only contain this two lines:

runtime: java11
instance_class: F4

yes! only this two lines are enought to run on gcloud that swagger generated project. There are so many different samples on stackoverflow, github, etc. including unalike sample app.yaml files made by google for the same task and the answer is so simple.

Best regards! :)

0
votes

Exact same issue , i am having for this sample https://github.com/GoogleCloudPlatform/java-docs-samples/tree/master/appengine-java8/helloworld-springboot

Followed the two lines it worked. runtime: java11 instance_class: F4

0
votes

By analogy with the answers above, the following helped:

runtime: java
env: flex    
instance_class: B4
manual_scaling:
  instances: 1
resources:
  memory_gb: 4

It can also be used if necessary automatic_scaling and instance_class F4.