-
Notifications
You must be signed in to change notification settings - Fork 167
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
Embedded vaadin flow component disappears after session timeout and also loads styles from wrong location. #19620
Comments
It seems that during resynchronize, some code tries to set the exported web component $server.disconnected function while $server is undefined, it seems to be this place:
|
Any updates? This has been under investigation for over a month now... |
No updates unfortunately, we have no solution at the moment, but will be keeping an eye on it and continue as soon as we can. |
I'm struggling with the same issue. Is there any possiblity to remove or shutdown a web component completely, without reloading the page? Thanks |
What I found is that there is something happening when Push is in use. So if I do not have Push enabled the resync works, but with push enabled there are 2 webcomponent-resync calls which breaks the webcomponent. So as a workaround one can use polling from the webcomponent instead of push while we try to get a fix for the problem with push. |
After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. Fixes #19620
After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620
* fix: reconnect web components after session expiration After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620 * add tests
* fix: reconnect web components after session expiration After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620 * add tests
* fix: reconnect web components after session expiration After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620 * add tests
…24.4) (#20440) * fix: reconnect web components after session expiration (#20407) * fix: reconnect web components after session expiration After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620 * add tests * fix pom files --------- Co-authored-by: Marco Collovati <[email protected]>
…24.5) (#20439) * fix: reconnect web components after session expiration (#20407) * fix: reconnect web components after session expiration After session expiration, Flow client in webcomponent mode send a GET request to the server to re-initialize itself with a valid session cookie. However, the XHR call is done with the withCredentials flag set to false, making the browser ignore the Set-Cookie header in the response. This change forces the withCredential flag to true for resync request so that the new cookie can be handled by the browser and reused in the subsequent request that re-intitializes the embedded component. If PUSH is enabled, it also restores the connection after resynchornization request to make sure pending invocation queue, and especially the webcomponent connected events, can be flushed correctly and sent to the server. Also temporarily suspends hearbeat during resynchronization request to prevent issue with concurrent requests, potentially causing duplicated session expiration handling on the client. Fixes #19620 * add tests * fix pom files --------- Co-authored-by: Marco Collovati <[email protected]>
This ticket/PR has been released with Vaadin 24.6.0.alpha3 and is also targeting the upcoming stable 24.6.0 version. |
Description of the bug
I have a vaadin flow component exported through WebComponentExporter and embedded in another page. When I e.g. let the laptop sleep for longer than session timeout duration or just put the browser to offline in Network tab in Developer tools, the server session expires in meantime and the embedded component disappears from page - it's still there in html source, but with nothing inside its shadow-root except one style element. I managed to replicate it also with latest skeleton starter application downloaded from vaadin.com where I just added the WebComponentExporter for the sample view, added cors filter bean registration and set the servlet session timeout to 60 seconds. After waiting for over 60 seconds in offline mode and then disabling offline mode the embedded component tries to resynchronize on next heartbeat or any other request to server and then disappears.
Also the embedded component tries to incorretly download styles from wrong host - my vaadin flow app is running on port 8080 and the embedded components tries to load styles from the page where it is embedded instead.
Browser console log: localhost-1718905756488.log
Expected behavior
Embedded flow component should not dissapear after server session expires.
Styles should be loaded from correct url.
Minimal reproducible example
See https://github.com/ggecy/embedded-component-issues
react-app
subfolder, I created a blank react app where inpublic/index.html
I added the embedded webcomponent. Go to this subfolder and runnpm install
and thennpm run start
to start the app on port 3000.http://localhost:3000
in chrome, the page should open with embedded component displayed. Open developer tools and in Network tab at the top choose Offline from throttling menu.Versions
The text was updated successfully, but these errors were encountered: