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.54k stars 4.02k forks source link

JHipster 7.6.0 gateway application using consul discovery service not rendering endpoints in swagger page #17839

Closed andytrujillorivero closed 10 months ago

andytrujillorivero commented 2 years ago
Overview of the issue

After upgrading a JHipster gateway project from version 7.1.0 to 7.6.0, endpoints in swagger page are not properly listed. Using Consul discovery service. Console shows an error trying to reach GET "/services/consul/management/jhiopenapigroups" endpoint. Same result with a new project, created from scratch.

WARN 7394 --- [r-http-kqueue-1] r.netty.http.client.HttpClientConnect    : [8eb3505a-1, L:/127.0.0.1:53148 ! R:127.0.0.1/127.0.0.1:8300] The connection observed an error

reactor.netty.http.client.PrematureCloseException: Connection prematurely closed BEFORE response

ERROR 7394 --- [r-http-kqueue-1] a.w.r.e.AbstractErrorWebExceptionHandler : [2d367c5d-33]  500 Server Error for HTTP GET "/services/consul/management/jhiopenapigroups"
Screen Shot 2022-02-09 at 12 03 11 Screen Shot 2022-02-09 at 12 03 39
Motivation for or Use Case

This did not happen before. Microservices endpoints do list OK in swagger, but not gateway ones. Error is shown in console with every access to administration's API page.

Reproduce the error

1- Generate a new JHipster gateway application with these options:

2- Start docker images 3- Log in at localhost:8080 with JHipster's default Keycloak admin credentials 4- Go to Administration / API in top right menu. 5- Check for errors in gateway logs, and browser console.

Related issues

Probably related, although it is for JHipster Registry and monolitic application: https://github.com/jhipster/generator-jhipster/issues/17531

Suggest a Fix

Handle access to GET "/services/consul/management/jhiopenapigroups"

JHipster Version(s)

7.6.0

JHipster configuration

yo-rc.json

Entity configuration(s) entityName.json files generated in the .jhipster directory
Browsers and Operating System
mraible commented 2 years ago

@mshima Do you recall fixing something like this recently? I saw this error in native mode.

mshima commented 2 years ago

@mraible fails to load the swagger ui or just the log? The discovery logic was moved from the server to the client. The error on the console is normal because it try and catch. I’ve added error handling at https://github.com/jhipster/generator-jhipster/issues/17531, I suppose it’s not related to discovery process.

The failure to show the api may be related to the openapi generator not been updated to oas3 https://github.com/jhipster/generator-jhipster/issues/17790.

PS: Would be nice to drop the discovery process in favor of spring-doc advertising to service discovery it’s api groups. Maybe be a good candidate for https://github.com/jhipster/generator-jhipster/issues/17641

pascalgrimaud commented 2 years ago

We need to simply ignore consul. Something like this, should do the job:

image

ongrieh commented 2 years ago

Hi Community,

this issue is not new or at least this behavior has shown before: https://github.com/jhipster/generator-jhipster/issues/17531 https://github.com/jhipster/generator-jhipster/issues/17489

Although both issues have been closed, for me it was never resolved until I tried JHipster Registry Release v7.3.0 as of today.

Regards Henry

mraible commented 2 years ago

@andytrujillorivero Can you please provide the steps to reproduce this issue. Does it still happen with JHipster 7.7?

andytrujillorivero commented 2 years ago

Thank you all for your comments on this issue! @pascalgrimaud's suggestion prevents the error to be shown, but still no gateway endpoints are listed in swagger. @mraible, I upgraded to JHispter 7.7 and tried again same steps from initial post (new gateway app, consul, OAuth 2.0, Postgres...). I got same result when trying to list gateway API endpoints in swagger: "No API definition provided". Microservices endpoints do list correctly in swagger. Same behavior using JHipster Registry 7.3.0.

BTW, JHipster is a great project. Congratulations!!

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for too long without any activity. Due to the moving nature of jhipster generated application, bugs can become invalid. If this issue still applies please comment otherwise it will be closed in 7 days