delian / node-unifiapi

UniFi API ported to Node.JS

Repository from Github https://github.comdelian/node-unifiapiRepository from Github https://github.comdelian/node-unifiapi

WRTC not working on Azure

ianisms opened this issue · comments

Azure App Service is not happy with the wrtc lib. Trying to use a different webrtc lib but not having any luck. Both easyrtc and webrtc.io fail in the same fashion.

My config:

import mywrtc from 'webrtc.io'; // import mywrtc from 'easyrtc';
...
this.unifiCloud = uCloud({
    deviceId: this.config.controllerDeviceId,
    username: this.config.username,
    password: this.config.password,
    webrtc: mywrtc,
    debug: app.logger.level === 'debug',
}).api;

And then after making a call using the api like so:

this.unifiCloud.authorize_guest(
        guest.macAddr,
        validMinutes
    ).then((data) => {
        resolve(data);
    }, (err) => {
        reject(err);
    });

I get the following error in the log (showing relevant part):

  WssAPI Connected wss://device-airos.svc.ubnt.com/api/airos/v1/unifi/events +392ms
  WssAPI Message Sending:  ping +0ms
  CloudAPI WebSocket is connected +2ms
  WssAPI Message Received: pong +82ms
  CloudAPI Received response: string +420ms
  CloudAPI now we have object +0ms
  CloudAPI WEBRTC_WS_SENDING +2ms
  WRTCRequest WRTC_PEER_OPEN { iceServers:
   [ { urls: 'stun:global.stun.twilio.com:3478?transport=udp',
       url: undefined },
     { urls: 'turn:global.turn.twilio.com:3478?transport=udp',
       url: undefined,
       username: 'UN',
       credential: 'PW' } ] } { optional: [ { DtlsSrtpKeyAgreement: true }, { RtpDataChannels: true } ] } +0ms
  CloudAPI Error in opening webrtc +1ms
(node:22168) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot create property 'message' on string 'Could not authorize'
(node:22168) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
  WssAPI Message Sending:  ping +9s
  WssAPI Message Received: pong +81ms

Any ideas?

I should say that wrtc (version 0.65) works fine on Windows 10 but not Windows Server (or at least the version of Windows Server used in App Services). I could definitely get this running in a VM and/or a container but, my goal is to get this running in Azure App Services.

It does make sense and really since WRTC is not a hard dependency for your project, really a non issue. I'll close it.