# ICE failure on Google Compute Engine Container

**URL:** <https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830>\
**Category:** Deployment & Scalability\
**Created:** [October 1, 2020, 7:58pm UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830 "2020-10-01T19:58:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oveddan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/oveddan/32/586_2.png) [@oveddan](https://mediasoup.discourse.group/u/oveddan)\
**Post date:** [October 1, 2020, 7:58pm UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/1 "2020-10-01T19:58:49Z")

</div>

I’ve been spending a while trying to sort this problem out.

I’m running a mediasoup server in a Google Compute Engine Instance, in a Docker container using the [Container Optimized OS](https://cloud.google.com/container-optimized-os/docs#:~:text=Container%2DOptimized%20OS%20is%20an,quickly%2C%20efficiently%2C%20and%20securely.)

I can get the solution running fine locally, but when trying to open a webrtc connection between two browser sessions, in Firefox, I get an error:

`WebRTC: ICE failed, add a STUN server and see about:webrtc for more details`

In Chrome, in chrome://webrtc\_internals, I see the following log events:

```auto
**transceiverModified**
Caused by: setLocalDescription

getTransceivers()[0]:{
  mid:'0',
  sender:{
    track:null,
    streams:[],
  },
  receiver:{
    track:'09a93399-d488-4581-9633-bc1a8ff10c2a',
    streams:[],
  },
  stopped:false,
  direction:'recvonly',
  currentDirection:'inactive',
}

**signalingstatechange**
stable

**setLocalDescriptionOnSuccess**

**iceconnectionstatechange**
disconnected

**iceconnectionstatechange (legacy)**
failed

connectionstatechange
failed

**close**

**connectionstatechange**
closed

```

The way I have things set up is:

- I bind a static external IP address to that compute engine instance’s network interface.
- For mediasoup, the `announceIp` is the static external ip address, and the `ip` is the `Primary Internal Ip` of the network interface.
- I know this is very insecure, but to see if it is an issue if ports are being blocked, for the firewall, I open all ingress and egress ports for that instance. In particular, I create an `Ingress` rule which allows all tcp and udp ports, for ip ranges `0.0.0.0/0` . I create an `Egress` rule which allows all tcp and udp ports, for ip ranges `0.0.0.0/0`. Once I have this problem figured out I’ll make more strict firewall rules.
- Not sure if this matters (don’t think it does), but https websockettraffic, and correspondingly the incoming protoo websocket connection goes through an https load balancer, and different ip address before hitting the instance.

How would I go about debugging why the Ice connection fails? Has anyone else had success getting a mediasoup worker instance to work in a compute engine container and has tips to share?

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [October 2, 2020, 12:52am UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/2 "2020-10-02T00:52:36Z")

</div>

Firefox is actually pretty good for debugging these kinds of issues. Just go to `about:webrtc`, clean everything and they do your test, then you’ll see all of the candidates, their status and even connection log about what was happening.

---

<div class="post-metadata">

**Author:** ![oveddan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/oveddan/32/586_2.png) [@oveddan](https://mediasoup.discourse.group/u/oveddan)\
**Post date:** [October 2, 2020, 1:40am UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/3 "2020-10-02T01:40:46Z")

</div>

Thank you @nazar-pc that was super helpful!!! The firefox tools are way more instructive.

So opening the firerfox about:webrtc dialog, it showed that under `remote candidate`, the ip was the internal ip address, or what I set as `ip` for `webRtcTransportOptions`.  
When I leave `announcedIp` null - and just set the `ip` to the external static ip address, it works.

What is the reason for this? I thought `ip` should be the internal ip of the network interface, and `announcedIp` should be the external ip? Why was my browser trying to bind the udp port of `ip` and not `announcedIp` ?

---

<div class="post-metadata">

**Author:** ![nazar-pc](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/nazar-pc/32/369_2.png) [@nazar-pc](https://mediasoup.discourse.group/u/nazar-pc)\
**Post date:** [October 2, 2020, 1:53am UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/4 "2020-10-02T01:53:11Z")

</div>

It should have been announce **d** Ip, did you mistype it in the code the same way?

`announcedIp` is the public IP in case your machine/container/etc. only has private address that is set in `ip`.

---

<div class="post-metadata">

**Author:** ![oveddan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/oveddan/32/586_2.png) [@oveddan](https://mediasoup.discourse.group/u/oveddan)\
**Post date:** [October 2, 2020, 2:01am UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/5 "2020-10-02T02:01:08Z")

</div>

I’m using typescript, so I don’t believe wasn’t mistyped. Have to investigate further, but not sure what happened.

---

<div class="post-metadata">

**Author:** ![oveddan](https://yyz2.discourse-cdn.com/free1/user_avatar/mediasoup.discourse.group/oveddan/32/586_2.png) [@oveddan](https://mediasoup.discourse.group/u/oveddan)\
**Post date:** [October 2, 2020, 4:06pm UTC](https://mediasoup.discourse.group/t/ice-failure-on-google-compute-engine-container/1830/6 "2020-10-02T16:06:31Z")

</div>

> [@nazar-pc](#):
>
> `about:webrtc`

I feel really stupid. I had a typo in my environment variable that caused announced ip to not be set. Anyways @nazar-pc thanks so much for pointing me to the firefox tool.
