[Vaadin.Router] Expected router outlet to be a valid DOM Node (but got null)

when I run our vaadin 23 app in production mode, I get following error in the browser console, while the corresponding site is rendered twice:

Uncaught (in promise) TypeError: [Vaadin.Router] Expected router outlet to be a valid DOM Node (but got null)

First it’s rendered with a corrupt textfield (UI written in Vaadin); the second page looks fine. When I try to debug (IntelliJ), it gets rendered correctly, so I added log messages, where I learned, that the HomeView gets initialized even three times, whereas in dev mode it is initialized once. I find it hard to figure out why, since that is run in a thread (I’m far from knowing Vaadin well).

We have two apps, a backoffice and a webshop. The non-responsive backoffice does not show this issue, only the webshop. The webshop also uses two lit web components (but even when I comment them out, I have the same error). The rest is all kept in Java.

Does anybody have an idea how to solve this, or in what direction to search and debug?

Thanks a lot! Sura

I also posted this question in stackoverflow and received a hint, which actually solved the problem. See: https://stackoverflow.com/questions/74928442/vaadin23-expected-router-outlet-to-be-a-valid-dom-node-but-got-null-and-homev

In case anyone runs into this thread later on, here’s the answer from @tireless-elk :

This is likely caused by a known bug with the eagerServerLoad flag. As a workaround, try disabling this flag to prevent the issue.

Add vaadin.eagerServerLoad=false to application.properties to disable the flag, assuming that your application uses Spring Boot. You could find alternative ways of setting the property see the Configuration Properties article.