0

I have simple micronaut application which has below one end point

  • test/g1

which returns some string.

I created the the fat jar and deployed same on PCF(pivotal cloud foundry). The application is in running state but I am not able to access the endpoint. Got the the below error -

502 Bad Gateway: Registered endpoint failed to handle the request.

Any kind of help is much appreciated.

Please note same application is running properly when deployed on my local machine.

Arvind Kumar
  • 459
  • 5
  • 21
  • I would suggest you run `cf logs` and see if anything shows up when you try to access the app. A 502 means that Gorouter waited and never got a response from your app. It could be taking too long or maybe your app is failing mid request (just speculating)? If you look at the logs you should minimally get an access log entry from Gorouter, look at the `response_time` it logs. If that's high, then it's probably timing out. If it's super short, then there is probably something failing after it's delivered the request to your app causing Gorouter to never get the reply. – Daniel Mikusa Oct 30 '19 at 19:30
  • Also, make sure your app is logging to STDOUT/STDERR so that your log messages show up in `cf logs`. Don't log to a file. – Daniel Mikusa Oct 30 '19 at 19:31
  • Thanks @DanielMikusa for response. I already have added the logs and I was there was health check failure but don't know why – Arvind Kumar Oct 31 '19 at 08:09
  • I was trying to and fro and when I removed the "micronaut.server.port=9012" from application.properties, it worked properly. It's strange as for spring-boot based app works properly with the port mentioned in application.properties but same is not working for micronaut – Arvind Kumar Oct 31 '19 at 08:11
  • 1
    Glad you were able to figure that out and get the app working. I agree that is a little odd. Normally with a Spring Boot app, the Java buildpack would set the env variable `SERVER_PORT` which would override what is set in application.properties or yml and make your app listen on 8080. It might be that the JBP doesn't know Micronaut and thus isn't setting `micronaut.server.port`, or maybe is still setting `server.port` which isn't the same. At any rate, it's not overriding what's in your config so you have to do it manually. – Daniel Mikusa Oct 31 '19 at 18:49

0 Answers0