On Thu, Jul 17, 2025 at 4:42 AM Rafi Shaik <[email protected]>
wrote:
> Dear Guacamole Community,
>
> I am currently integrating Apache Guacamole into a custom React-based
> frontend and am encountering an issue while establishing a connection using
> the WebSocket tunnel.
>
>
Are you using the full Guacamole Client web app deployed via Tomcat? Or
have you customized that, too?
> Here is a brief summary of my setup and the problem:
>
> - I am constructing the tunnel URL as follows:
>
> wss://localhost:8443/guacamole/websocket-tunnel?token=85A998473AB30BC6561687D237DDE49DE40D7EF165B238AEC9A45B2F1F8234FF&GUAC_ID=MzYAYwBwb3N0Z3Jlc3Fs&GUAC_TYPE=c?undefined
>
> - The WebSocket successfully connects with status code `101 Switching
> Protocols`, but the following error appears in the Guacamole server logs:
> ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket
> tunnel to guacd failed: Illegal identifier - unknown type.
>
> - It seems the issue is due to an improperly formatted `GUAC_TYPE`
> parameter (`c?undefined` instead of just `c`). I suspect that the URL
> construction on my end inadvertently introduced `?undefined`.
>
>
Yes, you'll need to resolve the fact that the code is introducing the
"?undefined" at the end of the URL. I don't know where this is coming from,
but it's a problem.
> ```jsx
> useEffect(() => {
> const token = localStorage.getItem('token');
> if (!token || !connectionId) {
> console.error('Missing token or connectionId');
> return;
> }
> const cleanConnectionId = String(connectionId).split('?')[0];
> const dataSource = 'postgresql';
> const type = 'c';
> // Encode identifier as per Guacamole format:
> [id]\x00[type]\x00[dataSource]
> const encodedId = btoa(`${cleanConnectionId}\x00${type}\x00${dataSource}`)
> const tunnelURL = `wss://localhost:8443/guacamole/websocket-tunnel?
> token=${token}&GUAC_ID=${encodedId}&GUAC_TYPE=${type}`;
> const tunnel = new Guacamole.WebSocketTunnel(tunnelURL);
> const client = new Guacamole.Client(tunnel);
> // Additional setup (display, mouse, keyboard, etc.)
> client.connect();
> }, [connectionId]);
>
> *I have also attached the pages to understand my code.*
>
> I would like to confirm:
>
> 1. What is the correct and expected format for the `GUAC_ID` and
> `GUAC_TYPE` parameters from the server’s point of view?
>
>
Without doing too much digging into the code, I believe GUAC_ID will be a
string value that represents the database identifier of the connection that
you're trying to open. GUAC_TYPE should be either "c" for connection or "g"
for connection group.
>
> 1.
> 2. Are there any changes or validations done by the Guacamole server
> that could reject a seemingly correct identifier?
>
>
I'm not sure what you mean, here. Yes, Guacamole is going to validate that
the items you provide are valid items based on what it expects. You should
correct the error you have above with the "?undefined" being added to the
URL and try, again.
>
> 1.
> 2. Is there a recommended way to debug or log the parsed identifier as
> received by the server for better visibility?
>
>
>
Yes:
https://guacamole.apache.org/doc/gug/configuring-guacamole.html#logging-within-the-web-application
Once you enable debugging, you can find the additional logging wherever
your Tomcat instance drops its logs - usually catalina.out.
-Nick
>