-
Notifications
You must be signed in to change notification settings - Fork 52
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
Force page reload on socket connect error 'parser error' #962
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…red-dashboard into 946_socket_error_recovery_2
…red-dashboard into 946_socket_error_recovery_2
cstns
requested changes
Jun 12, 2024
ui/src/main.mjs
Outdated
@@ -151,6 +151,14 @@ fetch('_setup') | |||
|
|||
socket.on('connect_error', (err) => { | |||
console.error('SIO connect error:', err, `err: ${JSON.stringify(err)}`) | |||
if (err?.code === "parser error") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
if (err?.code === "parser error") { | |
if (err?.code === 'parser error') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes linting errors
I had already fixed the linting errors. |
cstns
approved these changes
Jun 12, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
If there is a proxy server which requires a user login if the authorisation token expires, and the dashboard socket is already connected at this time, then the dashboard continues as normal, presumably because the connection is already open. If, however, the connection is dropped then the reconnect attempt fails as the request is forwarded to the login page. The result is that there is a connect error and the returned error object contains just
{"code":"parser error"}
. This is a permanent error, so retrying the connection is pointless.This PR recognises that code and forces a page reload, so that the user is directed to the login page.
There may be other reasons for a 'parser error', but whatever the reason there is little that we can do other than force a reload.
See discussions in #946, which this PR closes
Related Issue(s)
See discussions in #946, which this PR closes.
Checklist
flowforge.yml
?FlowFuse/helm
to update ConfigMap TemplateFlowFuse/CloudProject
to update values for Staging/ProductionLabels
area:migration
label