0

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

Sura Chaitanya
  • 243
  • 1
  • 4
  • 11
  • Errors on the server side? Are the two applications properly separated (different domains, different cookies, ...) to prevent the two vaadin apps from battling over the same cookie? Why do you mention "responsiveness" - do to what degree are they different and why would that matter? Other than than I have the feeling, that the provided info might not be enough to help here - this is lots of prose but no code. Please provide a [MRE](https://stackoverflow.com/help/minimal-reproducible-example) – cfrick Dec 27 '22 at 11:11
  • 1
    There is a [known bug with the `eagerServerLoad` flag](https://github.com/vaadin/hilla/issues/237) that might be the cause here. Could you, please, check if you have the `vaadin.eagerServerLoad` flag enabled? If so, does disabling it help? – Anton Platonov Dec 27 '22 at 12:07
  • OMG, @AntonPlatonov: I added a "vaadin.eagerServerLoad=false" to my application.properties, and the app runs fine now. You saved me - thanks a lot!!! Would you please write that as an answer, so I can approve it? – Sura Chaitanya Dec 27 '22 at 16:12
  • Wrote it. I'm glad to help you! – Anton Platonov Dec 28 '22 at 16:08

1 Answers1

1

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.

Anton Platonov
  • 336
  • 1
  • 5