OTA.Update call fails, unable to perform DNS lookup

I am attempting to demonstrate OTA to a ESP32 to my customer.

I have firmware loaded into the device (tagged as version 1.2.0), the device is licensed, and running against Mongoose OS 2.13.0.

I placed a ‘newer’ version of the firmware onto Amazon S3. Firmware is identical except the version number is bumped to 1.2.1.

I have the configuration set up to log via UDP so I can watch without a serial connection.

If I issue

mos call OTA.Update '{"url": "https://sti-gateway.s3.us-east-1.amazonaws.com/fw-1.2.1.zip"}'

the device appears to reboot (my logging goes dead for a bit, then comes back up with a new set of sequence numbers on the log messages), and when it comes back up, I see “Failed to resolve ‘sti-gateway.s3.us-east-1.amazonaws.com’, server 8.8.8.8”.

2019-05-30 11:17:56 EDT - sti_B4E62DD60069 145 1559229477.064 2|net.c:80                MQTT_EV_MQTT_PUBACK (msg_id: 15)
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 66 10.795 2|net.c:180               WiFi STA IP acquired 0x0
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 67 10.807 2|mgos_net.c:101          WiFi STA: ready, IP 192.168.1.237, GW 192.168.1.254, DNS 192.168.1.254
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 68 10.812 2|net.c:146               Net got IP address
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 69 10.817 2|mgos_provision_state:43 Current state: 1 -> 2
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 70 10.826 2|mgos_mqtt.c:427         MQTT connecting to a2g58yidv8s7pn.iot.us-east-1.amazonaws.com:8883
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 71 10.974 2|mg_ssl_if_mbedtls.c:35  0x3ffe7418 ciphersuite: TLS-ECDHE-ECDSA-WITH-AES-128-GCM-SHA256
2019-05-30 11:19:00 EDT - sti_B4E62DD60069 72 11.002 2|SW ECDSA verify curve 3 hash_len 32 sig_len 72
2019-05-30 11:19:01 EDT - sti_B4E62DD60069 73 11.852 2|SW ECDSA verify curve 3 hash_len 64 sig_len 71
2019-05-30 11:19:01 EDT - sti_B4E62DD60069 74 12.665 2|SW ECDH curve 3
2019-05-30 11:19:03 EDT - sti_B4E62DD60069 75 13.939 2|mgos_mongoose.c:66      New heap free LWM: 76196
2019-05-30 11:19:03 EDT - sti_B4E62DD60069 76 13.949 2|mg_resolv.c:213         Failed to resolve 'sti-gateway.s3.us-east-1.amazonaws.com', server 8.8.8.8
2019-05-30 11:19:03 EDT - sti_B4E62DD60069 77 13.954 2|mgos_ota_http_clien:123 Connect error: -1
2019-05-30 11:19:03 EDT - sti_B4E62DD60069 78 13.962 2|mgos_ota_http_clien:102 Connect error

That DNS name is resolvable at server 8.8.8.8:

user@dell2400-linux:~$ nslookup sti-gateway.s3.us-east-1.amazonaws.com 8.8.8.8
Server:		8.8.8.8
Address:	8.8.8.8#53

Non-authoritative answer:
sti-gateway.s3.us-east-1.amazonaws.com	canonical name = s3.us-east-1.amazonaws.com.
Name:	s3.us-east-1.amazonaws.com
Address: 52.216.101.221

What steps can I take to get a clearer idea of what’s happening?

Why is it using 8.8.8.8 when the assigned DNS is 192.168.1.254?

sti-gateway.s3.us-east-1.amazonaws.com is an alias for s3.us-east-1.amazonaws.com.
Did you try to use s3.us-east-1.amazonaws.com in the OTA update command?

I have no idea why 8.8.8.8 is being used.

yes, I have tried using both sti-gateway.s3.us-east-1.amazonaws.com and s3.us-east-1.amazonaws.com. Same issue.

This does work if I put the RPC call in over a web socket instead of over the serial port. Could it be that the mos command (when used over the serial port) is rebooting the esp32, and that the attempt to do DNS happens before the network is fully up and operational?

could you fix that? I have the same issue with

[Feb 23 14:47:07.473] mongoose.c:12126        Failed to resolve 'suvie-firmware-temp.s3.amazonaws.com', server 75.75.75.75
[Feb 23 14:47:07.473] mgos_ota_http_clien:123 Connect error: -1
[Feb 23 14:47:07.504] mgos_ota_http_clien:102 Connect error

@nliviu can you help me with the issue??

It looks like 75.75.75.75 is not a DNS server.

dig @75.75.75.75 suvie-firmware-temp.s3.amazonaws.com

; <<>> DiG 9.16.37-Debian <<>> @75.75.75.75 suvie-firmware-temp.s3.amazonaws.com
; (1 server found)
;; global options: +cmd
;; connection timed out; no servers could be reached

I’m just starting OTA with mgos_ota_http_start and the url you see in my previous post, I have no idea why it uses the 75.75.75.75 as DNS server. How can I specify a DNS server for mgos_ota_http_start?

The DNS server is provided by your DHCP server.

is there a way to set fallback DNS server?

You might want to fix your dhcp server.