Mediasoup stuck on "connecting" in `transport.on("connectionstatechange", cb())` on heroku

Good day all, am relatively new to WebRTC and mediasoup, but ive read the documentation and everything tends to work fine on localhost but when i deploy my app on heroku the transport.on("connectionstatechange", cb()) is always stuck on case “connecting”, i could guess the bug is from the announcedIpon webRtcTransport.listenIps[] but somehow i couldn’t get it working on Heroku, my second guess is that heroku is blocking the IP address somehow on how mediasoup works, nevertheless this works well on localhost but on production in heroku its stuck on connecting, please help me out, below it a copy of my config.ts file

export default {
  listenIp: '127.0.1.1',
  // listenPort: 3000,
  sslCrt: './keys/server.crt',
  sslKey: './keys/server.key',
  mediasoup: {
    // Worker settings
    worker: {
      rtcMinPort: 40000, //10000,
      rtcMaxPort: 49999, //10100,
      logLevel: 'warn',
      logTags: [
        'info',
        'ice',
        'dtls',
        'rtp',
        'srtp',
        'rtcp',
        'rtx',
        'bwe',
        'score',
        'simulcast',
        'svc',
      ],
    },
    // Router settings
    router: {
      mediaCodecs: [
        {
          kind: 'audio',
          mimeType: 'audio/opus',
          clockRate: 48000,
          channels: 2,
        },
        {
          kind: 'video',
          mimeType: 'video/VP8',
          clockRate: 90000,
          parameters: {
            'x-google-start-bitrate': 1000,
          },
        },
        {
          kind: 'video',
          mimeType: 'video/VP9',
          clockRate: 90000,
          parameters: {
            'profile-id': 2,
            'x-google-start-bitrate': 1000,
          },
        },
        {
          kind: 'video',
          mimeType: 'video/h264',
          clockRate: 90000,
          parameters: {
            'packetization-mode': 1,
            'profile-level-id': '4d0032',
            'level-asymmetry-allowed': 1,
            'x-google-start-bitrate': 1000,
          },
        },
        {
          kind: 'video',
          mimeType: 'video/h264',
          clockRate: 90000,
          parameters: {
            'packetization-mode': 1,
            'profile-level-id': '42e01f',
            'level-asymmetry-allowed': 1,
            'x-google-start-bitrate': 1000,
          },
        },
      ],
    },
    // WebRtcTransport settings
    webRtcTransport: {
      listenIps: [
        {
          ip: '127.0.0.1',
          announcedIp: null,
        },
      ],
      minimumAvailableOutgoingBitrate: 600000,
      maxSctpMessageSize: 262144,
      // Additional options that are not part of WebRtcTransportOptions.
      maxIncomingBitrate: 1500000,
      initialAvailableOutgoingBitrate: 1000000,
    },
  },
}

Thanks for your quick reply, i immediately followed this link https://mediasoup.discourse.group/t/difficulty-with-listen-ips-web-connection/1549/1 and am pretty sure the error is from Heroku ephemeral distribution of IP addresses, thanks for your reply, am currently reading the docs now

You need to know the public IP of your server or the public IP that your cloud provider redirects to your server.

1 Like