RocketChat / Rocket.Chat

The communications platform that puts data protection first.
https://rocket.chat/
Other
39.88k stars 10.26k forks source link

WebRTC (Video)Calls not working #10868

Open 5hay opened 6 years ago

5hay commented 6 years ago

Description:

Hello everyone.

I have Rocket.Chat installed via Docker and I have a Nginx reverse proxy (also Docker) in front of RC with SSL enabled and working. Chat works fine.

But I can't get (Video)Calls over WebRTC to work. When I click on Video Chat, I see myself in the feed but the user I'm trying to call doesn't receive anything on his end.

Tested on Windows 10 and Windows 7 with Chrome and Firefox. Also tested with the Electron Desktop app. Newest versions, 64bit. Both users are on the same network.

I even set the INSTANCE_IP env var, it's set to the local IP of the Docker container (https://github.com/RocketChat/Rocket.Chat/issues/4738#issuecomment-300022476)

test.webrtc Result: grafik

docker-compose.yml

version: '3'

services:
  nginxproxy:
    image: jwilder/nginx-proxy:alpine
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443" 
      - "444:444" # rocket.chat
    volumes:
      - /home/dockeruser/certs:/etc/nginx/certs
      - /home/dockeruser/nginx/conf.d:/etc/nginx/conf.d
      - /home/dockeruser/nginx/vhost.d:/etc/nginx/vhost.d:ro
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      - cloudnet

  rocketchat:
    image: rocketchat/rocket.chat:latest
    restart: unless-stopped
    volumes:
      - /home/dockeruser/rocketchat/uploads:/app/uploads
    environment:
      - VIRTUAL_HOST=chat.censored.com
      - ROOT_URL=https://chat.censored.com
      - MONGO_URL=mongodb://mongo:27017/rocketchat
      - MONGO_OPLOG_URL=mongodb://mongo:27017/local
      - INSTANCE_IP=172.18.0.5
      - Accounts_UseDNSDomainCheck=False
    depends_on:
      - mongo
      - nginxproxy
    ports:
      - 3000:3000
    networks:
      - cloudnet

  mongo:
    image: mongo:3.2
    restart: unless-stopped
    volumes:
     - /home/dockeruser/rocketchat/data/db:/data/db
     - /home/dockeruser/rocketchat/data/dump:/dump
    command: mongod --smallfiles --oplogSize 128 --replSet rs0 --storageEngine=mmapv1
    networks:
      - cloudnet

  mongo-init-replica:
    image: mongo:3.2
    command: 'mongo mongo/rocketchat --eval "rs.initiate({ _id: ''rs0'', members: [ { _id: 0, host: ''localhost:27017'' } ]})"'
    depends_on:
      - mongo
      - nginxproxy

Nginx Config

# If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the
# scheme used to connect to this server
map $http_x_forwarded_proto $proxy_x_forwarded_proto {
  default $http_x_forwarded_proto;
  ''      $scheme;
}
# If we receive X-Forwarded-Port, pass it through; otherwise, pass along the
# server port the client connected to
map $http_x_forwarded_port $proxy_x_forwarded_port {
  default $http_x_forwarded_port;
  ''      $server_port;
}
# If we receive Upgrade, set Connection to "upgrade"; otherwise, delete any
# Connection header that may have been passed to this server
map $http_upgrade $proxy_connection {
  default upgrade;
  '' close;
}
# Apply fix for very long server names
server_names_hash_bucket_size 128;
# Default dhparam
ssl_dhparam /etc/nginx/dhparam/dhparam.pem;
# Set appropriate X-Forwarded-Ssl header
map $scheme $proxy_x_forwarded_ssl {
  default off;
  https on;
}
gzip_types text/plain text/css application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
log_format vhost '$host $remote_addr - $remote_user [$time_local] '
                 '"$request" $status $body_bytes_sent '
                 '"$http_referer" "$http_user_agent"';
access_log off;
resolver 127.0.0.11;
# HTTP 1.1 support
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $proxy_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto;
proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl;
proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port;
# Mitigate httpoxy attack (see README for details)
proxy_set_header Proxy "";
server {
        server_name _; # This is just an invalid value which will never trigger on a real hostname.
        listen 80;
        access_log /var/log/nginx/access.log vhost;
        return 503;
}
upstream chat.censored.com {
                        server 172.18.0.5:3000;
}
server {
        server_name chat.censored.com;
        listen 80 ;
        access_log /var/log/nginx/access.log vhost;
        return 301 https://$host$request_uri;
}
server {
        server_name chat.censored.com;
        listen 443 ssl http2 ;
        access_log /var/log/nginx/access.log vhost;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers 'ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA:ECDHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:!DSS';
        ssl_prefer_server_ciphers on;
        ssl_session_timeout 5m;
        ssl_session_cache shared:SSL:50m;
        ssl_session_tickets off;
        ssl_certificate /etc/nginx/certs/censored.com.crt;
        ssl_certificate_key /etc/nginx/certs/censored.com.key;
        add_header Strict-Transport-Security "max-age=31536000" always;
        include /etc/nginx/vhost.d/chat.censored.com.biz;
        location / {
                proxy_pass http://chat.censored.com;
        }
}

Server Setup Information:

Steps to Reproduce:

  1. Click on user you want to call
  2. Start video chat
  3. Video of yourself is being opened
  4. User you're trying to call doesn't get any notification or anything at all (except the JS errors, see Logs)

Expected behavior:

The user that is being called should get a notification or something that he is being called

Actual behavior:

When the call is instantiated, open the Browser JavaScript console and you get "Uncaught TypeError: Cannot read property 'user' of undefined"

The user that is being called also gets an error in their JS console saying: "uncaught exception: [sprintf] huh?"

Relevant logs:

Exact error after starting the video call

b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:427 Uncaught TypeError: Cannot read property 'user' of undefined
    at Object.click .js-action (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:427)
    at b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
    at Function.e._withTemplateInstanceFunc (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87)
    at f.View.<anonymous> (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87)
    at b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
    at Object.f._withCurrentView (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87)
    at f._DOMRange.<anonymous> (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87)
    at HTMLButtonElement.delegatedHandler (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87)
    at HTMLElement.dispatch (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:9)
    at HTMLElement.h.handle (b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:9)
click .js-action @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:427
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
e._withTemplateInstanceFunc @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
f._withCurrentView @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
delegatedHandler @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:87
dispatch @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:9
h.handle @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:9
11:49:52.887 

Exact error the user gets that is being called

b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167 Uncaught [sprintf] huh?
r.parse @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
r @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
G @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
F @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
C @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:167
t @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:209
n @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:437
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:437
e @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:437
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:437
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
e @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
e @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:171
(anonymous) @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
t @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
socket.onmessage @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
o.dispatchEvent @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
T._dispatchMessage @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
T._didMessage @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
o.ws.onmessage @ b0568d82eb74f09c119e40084994141e18ccce49.js?meteor_js_resource=true:57
sysdef commented 5 years ago

hint: you should use something like example.com as described in https://tools.ietf.org/html/rfc2606 . Using censored.com is just BEEEP BEEEEEEEP.

WingsLikeEagles commented 4 years ago

Could this be a JavaScript solution?

https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/