-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swagger UI shows a blank page #10163
Comments
Note, that Swagger UI seems to work fine in v14.X |
Same error on
|
The issue is most likely a generic one even though it's technically a Spring add-on issue. |
It needs to be exactly |
I am using vaadin flow 23, Java 17, Spring boot 2.7.0 and config not work. Error message: I think we don't need change vaadin base URL but we need config to set Vaadin servlet URL mapping having lowest priority in Spring. So it won't block other servlet mappings as CXF/swagger. URL mapping priority maybe (Low to High): Spring servlet -> Vaadin servlet -> CXF/Swagger. |
I figured it out. And it appears to be a bug, but there is a simple way to avoid it. Vaadin version I had the following
The problem is in this code below. Specifically in the name of the setting and how to get it by
We have the name of the setting BUT the way to get the setting To get the setting correctly, you need to get the So at this point you can easily bypass this problem and use the configuration name |
Sounds like what was fixed in #13791 |
The issue still happens even we change url-mapping. It is better to fix on issue #12949 |
@letrthang, I have the same setup (based on your screenshots) and it works for me. spring/issues#602 contains some details why simply changing the orders of the URL mappings for Vaadin and Spring's resource handlers won't help. |
@Frettman it still doesn't work for me. I cannot access restful resource using postman and also swagger UI page doesn't show up. |
@letrthang, that error from your first screenshot is not from Vaadin; Vaadin would show something like in the image from this Stackoverflow question. |
@Frettman i created a test endpoint in vaadin demo project here, swagger still not work. result: Postman to send request also taken control by Vaadin handler: |
@tarekoraby @denis-anisimov may i know you have any plan to fix this issue ? |
@mshabarov, can someone from the Flow team please provide an update on this issue? |
This seems to work fine.
opening http://localhost:4444/swagger-ui.html shows the swagger UI |
this config now will work with vaadin 23.2.1
However I prefer to get same config as Vaadin 14 as below which Vaadin home is root URL and allow to exclude swagger from root url (for now, this config is not working):
Anyway, there is other issue with open-api and Hilla: Both springdoc-openapi-ui and Hilla using swagger-core and swagger-models with different versions, so causing swagger crashing. Below config will work:
Below config will not work:
I submitted new issue to Hilla here: |
Without the url mapping it seems that the Vaadin handler is invoked before the Swagger handler, preventing the swagger ui from showing. If this order is removed https://github.com/vaadin/flow/blob/master/vaadin-spring/src/main/java/com/vaadin/flow/spring/VaadinServletConfiguration.java#L61 the Swagger UI is shown but instead Vaadin views fail to render because of a 404 |
@Artur-, it's what I described in detail in vaadin/spring#602 and an attempt at a solution in vaadin/spring#604. |
Thanks, I was just wondering if there really is no concept of "I want to handle some of the paths that match this mapping so ask me and if I say 'no thanks', then ask the next handler". It sounds really impossible to be able to answer upfront "Will Vaadin handle this request" without actually letting Vaadin handle the request and see. The static cases like routes are easy, the dynamic code that you are able to add here and there is not. |
So if the resource handler and the Vaadin handler could be combined so that if the first returns 404, the second one is consulted then magically everything would work.. |
This is fixed in #14579 but not in a fully automatic way. You can define paths to exclude, e.g. |
Description of the bug / feature
In a Vaadin 18 + Spring app, swagger-ui page is not showing (returns a blank page) with errors in the console.
Minimal reproducible example
vaadin.urlMapping
inapplication.properties
. For example,Expected behavior
The Swagger UI page is opened
Actual behavior
Only a blank page is displayed with the following errors in the console
![image](https://user-images.githubusercontent.com/42799254/109612678-c34e3680-7b38-11eb-963a-ead1b68e1a83.png)
Versions:
The text was updated successfully, but these errors were encountered: