node-red-dashboard icon indicating copy to clipboard operation
node-red-dashboard copied to clipboard

Yet Another PWA Hang - after dashboard (or node red) update

Open colinl opened this issue 1 year ago • 0 comments

Current Behavior

On a system using cloudflare Zero Trust for authorisation, after upgrading node red and the dashboard (I don't know which was the trigger) I find that if, in addition, the authorisation token has expired, existing PWA apps hang on startup, showing a blank page. In the developer tools I see An error occurred: SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

Refresh does not fix it. However, if I clear the browser cache then it shows the cloudflare logon page, as it should. It appears to be hitting the last console.error in this code from ui/src/main.mjs

fetch('_setup')
    .then(async (response) => {
...
    })
    .catch((err) => {
        if (err instanceof TypeError && err.message === 'Failed to fetch') {
            forcePageReload(err)
        } else {
            // handle general errors here
            console.error('An error occurred:', err)
        }
    })

In this case forcing a page reload would presumably fix it, but then there is the possibility of repeated reload attempts if the error is caused by something else. On the other hand, what else can we do if there is an error? Just hanging with a blank screen and no notification is not ideal.

Expected Behavior

No response

Steps To Reproduce

No response

Environment

  • Dashboard version: 1.12.1
  • Node-RED version: 4.0.1
  • Node.js version:
  • npm version:
  • Platform/OS: Ubuntu and Android
  • Browser: Edge and Chrome

Have you provided an initial effort estimate for this issue?

I am not a FlowFuse team member

colinl avatar Jun 30 '24 08:06 colinl