How to properly connect to Guacamole through guacamole-common-js

I have a Google Cloud Virtual Machine instance which has Guacamole installed on it via Docker. I can access via my browser correctly via http://[virtualmachineip]:8080/guacamole/#/ and control it.

I’m building a Svelte app that would let me control the virtual machine through this Client, however I keep receiving the error: ERROR o.a.g.w.GuacamoleWebSocketTunnelEndpoint - Creation of WebSocket tunnel to guacd failed: Parameter "GUAC_ID" is required. on my guacamole docker logs.

Here is how my javascript code is looking:

  function initializeGuacamoleClient() {

    var tunnel = new Guacamole.WebSocketTunnel(
      "ws://[virtualmachineaddress]:8080/guacamole/websocket-tunnel"
    );

    guacClient = new Guacamole.Client(tunnel);

 
    if (displayContainer) {
      displayContainer.appendChild(guacClient.getDisplay().getElement());
      displayContainer.style.display = "block";
      guacClient.connect("username=guacadmin&password=guacadmin");
    }
  }

I would appreciate any inputs because I have not found any rellevant information on the documentation.

Here is my docker-compose.yml just in case it may have something to do.

version: '3'

services:
  guacd:
    image: guacamole/guacd
    container_name: guacd
    restart: always
    ports:
      - "4822:4822"

  mysql:
    image: mysql:5.7
    container_name: guac_mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: (my password)
      MYSQL_DATABASE: guacamole_db
      MYSQL_USER: guacamole_user
      MYSQL_PASSWORD: (my password)
    volumes:
      - guacamole_db:/var/lib/mysql

  guacamole:
    image: guacamole/guacamole
    container_name: guacamole
    restart: always
    depends_on:
      - guacd
      - mysql
    environment:
      GUACD_HOSTNAME: guacd
      MYSQL_HOSTNAME: mysql
      MYSQL_DATABASE: guacamole_db
      MYSQL_USER: guacamole_user
      MYSQL_PASSWORD: (my password)
      GUACAMOLE_CORS_ENABLED: 'true'
      GUACAMOLE_CORS_ALLOWED_ORIGINS: '*'
      GUACAMOLE_CORS_ALLOWED_METHODS: 'GET, POST, PUT, DELETE, OPTIONS'
    ports:
      - "8080:8080"
    links:
      - guacd
      - mysql

volumes:
  guacamole_db:

I’m using this library https://www.npmjs.com/package/guacamole-common-js
Thank you so much.