vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
618 stars 167 forks source link

Improve the client-side exception handling for "Invalid JSON from server" errors #19514

Open johannest opened 5 months ago

johannest commented 5 months ago

Describe your motivation

Every now and then we have a customer who's end users stumble upon a various form of a big ugly "Invalid JSON from server:" error messages. Usually the root cause is proxy or firewall which will dump html content to the Vaadin client-side instead of the UIDL request. At the moment there is no official documentation for the workaround (Vaadin-Refresh token) and no other way than silently refresh the page or redirect (with Vaadin-Refresh token).

Describe the solution you'd like

Describe alternatives you've considered

Instead of proper documentation, we usually let customer know this StackOverflow answer

Related issues

Legioth commented 5 months ago

a possibility to log the issue in the server (e.g. to see how often it happens)

That error is shown because something gets in between the communication between the client and the server. How could the client then let the server know about it?

a possibility let user to choose what to do: e.g. ignore, refresh the page etc.

Ignoring is probably dangerous since the client-side state is probably out of sync with the server-side state.

johannest commented 5 months ago

That error is shown because something gets in between the communication between the client and the server. How could the client then let the server know about it?

Assuming this is a single failed request then the server is very likely accessible. But in generic case: one possibility could be through the refresh/redirect call (for example with a URL parameter), but I guess that is an application specific thing so might not make sense to try to do it in the core flow.