Is it possible to create customized error pages instead of throwing raw json output to the user? Specifically, userCodeTimeoutError. For example, some of out pages can load more then 60s. We would like to set up some kind of “please wait” page after 30s and allow user to wait until we are ready to show the page.
We have created an internal ticket to track this - XDN-8818
The serverless timeout is limited to 20s. If you know that you page make take a long time then you should always return an intermediate page that should then poll the results that you want to display. This will provide your users with a better UX and avoid any gnarly issues around timing. However, any such polling system has to be implemented outside of XDN serverless: serverless can query the results from a backend but cannot create and store results themselves (technically it can but only within 20s timeout which would not be useful for your use case)
@ierceg technically speaking yes, we can try to get around this issue by managing timeout by ourselves and showing some other page. The problems I see here:
- Timeout is not documented and can be changed without notice, so “custom” code will break
- Projects might hit this kind of errors in production, after the initial implementation. Resolving this might take significant time end effort while suffering downtime.
On the other hand, custom error routes in case of unexpected app behaviour would be a big plus for the platform.
Sorry, maybe I’ve misunderstood the intent here:
We would like to set up some kind of “please wait” page after 30s and allow user to wait until we are ready to show the page.
For custom error page to serve as a waiting page, the developers would have to read the request data from the served error page, search for the ongoing backend query based on that data and then wait for response. Unless I’m missing something this strikes me as more work (in development and during runtime) than simply immediately serving a waiting page with a known request ID. Either way the projects have to take this into account during development.
Timeout is documented here Moovweb XDN Documentation - Limits.
We would like to return “please wait” page only in case of error/timeout happened. This could happen, let’s say, in 15% of scenarios. So other 85% of “good” responses should not slow down UX for the user and show intermediate page, and then instantly switch them to required page.
Having custom error page, we can at least start with providing styled page with links etc, so the user can navigate back to the site.
@arturkin Absolutely agree on the need for custom error pages and using them to give better UX and allow users to navigate back to the site is an optimal use.
However, for your original use (serve a wait page on error), consider that any custom error pages will have to be statically rendered during the build (otherwise serverless has to run twice which means that it could once again fail and then lead to a cascading failure). If that is not desirable then your best course of action is to serve the wait page after a more aggressive timeout than XDN platform provides (e.g. after 15s have passed in the serverless, trigger the serving of a wait page which embeds the response ID that can then be queried)