[ 
https://issues.apache.org/jira/browse/GUACAMOLE-2290?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nick Couchman resolved GUACAMOLE-2290.
--------------------------------------
    Fix Version/s: 1.6.1 [staging]
       Resolution: Fixed

> White screen with no error message when localStorage GUAC_AUTH_TOKEN is 
> "undefined"
> -----------------------------------------------------------------------------------
>
>                 Key: GUACAMOLE-2290
>                 URL: https://issues.apache.org/jira/browse/GUACAMOLE-2290
>             Project: Guacamole
>          Issue Type: Bug
>          Components: guacamole-client
>            Reporter: Per von Zweigbergk
>            Priority: Major
>             Fix For: 1.6.1 [staging]
>
>
> I have run into an issue where Guacamole fails to load and presents the user 
> with a white screen, instead of the expected login page. Refreshing doesn't 
> resolve the issue.
> After some investigation, I found an error message like this in the 
> Javascript console:
> jquery.min.js:2
>  Uncaught SyntaxError: "undefined" is not valid JSON
>     at JSON.parse (<anonymous>)
>     at a.getItem (localStorageService.js:125:25)
>     at h.getCurrentToken (authenticationService.js:466:36)
>     at h.request (authenticationService.js:536:34)
>     at Object.getLanguages (languageService.js:45:38)
>     at v (translationLoader.js:74:25)
>     at translationLoader.js:149:9
>     at Object.invoke (angular.min.js:45:264)
> The relevant code appears to be here:
> [https://github.com/apache/guacamole-client/blame/27922fe19823942e7bc3a6b70560cebabec44e64/guacamole/src/main/frontend/src/app/storage/services/localStorageService.js#L125]
> Investigating the local storage, the {{GUAC_AUTH_TOKEN}} value seems to be 
> set to the string "undefined" whenever this problem occurs.
> I've not been able to figure out *why* the GUAC_AUTH_TOKEN value is set to 
> "undefined". It could be an interaction with the Barracuda WAF we have in 
> front. But either way, it appears there is a specific bug in this part of the 
> code. There is no proper handling of the exception thrown by the 
> JSON.parse(data) call, if data is invalid JSON (in this case, the string 
> "undefined").
> Either way, the fact that guacamole-client itself chokes in case the 
> GUAC_AUTH_TOKEN value ends up being corrupted is a bug in its own right, and 
> could be easy enough to fix by just handling the SyntaxError exception being 
> thrown by JSON.parse and treating it as an empty value in this case.
> As a workaround, I've been telling my users to run the following command in 
> the Javascript console to clear out this state: 
> {{localStorage.removeItem('GUAC_AUTH_TOKEN');}} and this seems to 
> temporarilly fix the issue, which leads me to believe that adding some guards 
> around JSON parsing and treating an unparsable value as missing would 
> properly mask your problem.
> I'm up submitting a PR for this if this approach to the fix is accepted.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to