We are operating a distributed system with a single MySQL server running in one geographical region and multiple Guacamole nodes running in many locations worldwide. We noticed that some Guacamole instances were not able to use the file upload feature. The POST request for the upload would always return a 404 error and after further inspection, we noticed that the tunnel id used in the post request was null (e.g. https://myguacamole.com/api/session/tunnels/null/streams/1/filename.png?token=...)
After digging into the guacamole-common-js code some more, we noticed that the tunnel uuid is only set if the tunnel is in the CONNECTING state (https://github.com/apache/guacamole-client/blob/master/guacamole-common-js/src/main/webapp/modules/Tunnel.js#L1018). In our case, the round-trip to the MySQL server adds a significant latency to the tunnel opening and the tunnel switches into the UNSTABLE state before the tunnel UUID is transferred. Therefore, the tunnel UUID is never set and any file upload fails.
I'm proposing to change the previously linked to condition to the following:
I'm happy to provide a PR if this sounds reasonable.