dgreif / ring

Unofficial packages for Ring Doorbells, Cameras, Alarm System, and Smart Lighting
MIT License
1.21k stars 163 forks source link

Failed to reach Ring server 9.x+ #397

Closed doomstare closed 4 years ago

doomstare commented 4 years ago

Bug Report

Describe the Bug

I am getting the following error when updating to any version 9.0 and up.

Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. queryAaaa EREFUSED app.ring.com. Trying again in 5 seconds...

Rolled back every version until I hit 8.2.0 and everything was working again. Been searching for 2 days for similar issue but couldn't find anything

Environment

dgreif commented 4 years ago

Can you give v9.5.0 a try?

doomstare commented 4 years ago

Still receiving an error on 9.5.0:

Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. queryA EREFUSED app.ring.com. Trying again in 5 seconds...

Thanks for your work, it is very appreciated

dgreif commented 4 years ago

Do you have anything unique on your network setup? Like a pihole or something that does dns caching?

doomstare commented 4 years ago

Nothing that I know of. Mac mini goes straight to Linksys EA9500 router. Firewall on the Mac is off. I flushed the Mac dns before my original post. Before running on the Mac I was running homebridge on a FreeBSD platform with no problem. Just checked my FreeBSD platform with 9.5.0 and runs without issue.

dgreif commented 4 years ago

Can you set ‘“debug”: true’ in your ring config? Should log some additional info about the dns failure. Could also try node 14.5.0 but I’m not sure that will make a difference

doomstare commented 4 years ago

[7/11/2020, 12:59:24 PM] [Ring] DNS Cache for app.ring.com: {"errno":"EREFUSED","code":"EREFUSED","syscall":"queryAaaa","hostname":"app.ring.com"} [7/11/2020, 12:59:29 PM] [Ring] Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations. queryAaaa EREFUSED app.ring.com. Trying again in 5 seconds... [7/11/2020, 12:59:29 PM] [Ring] RequestError: queryAaaa EREFUSED app.ring.com at PromisableRequest._makeRequest (/usr/local/lib/node_modules/homebridge-ring/node_modules/got/dist/source/core/index.js:1075:19) at processTicksAndRejections (internal/process/task_queues.js:97:5) at QueryReqWrap.onresolve [as oncomplete] (internal/dns/promises.js:174:17) { code: 'EREFUSED', timings: undefined }

dgreif commented 4 years ago

There is definitely something in your server or network blocking the dns request. @dxdc any ideas?

dxdc commented 4 years ago

I agree. @doomstare please post the results of:

scutil --dns
cat /etc/hosts
dig a app.ring.com
dig aaaa app.ring.com

I'm wondering if it's an IPv6 issue, given that the aaaa query failed.

dxdc commented 4 years ago

Also, you may want to check the Security & Privacy system pref pane under System Preferences and confirm there is no issue with your Firewall (at least, you can disable it to test). And flushing your cache is an option too:

dscacheutil -flushcache
sudo killall -HUP mDNSResponder
doomstare commented 4 years ago

@server ~ % scutil --dns DNS configuration

resolver #1 nameserver[0] : 10.0.1.2 nameserver[1] : 75.75.75.75 nameserver[2] : 10.0.1.1 flags : Request A records reach : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

resolver #2 domain : local options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 300000

resolver #3 domain : 254.169.in-addr.arpa options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 300200

resolver #4 domain : 8.e.f.ip6.arpa options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 300400

resolver #5 domain : 9.e.f.ip6.arpa options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 300600

resolver #6 domain : a.e.f.ip6.arpa options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 300800

resolver #7 domain : b.e.f.ip6.arpa options : mdns timeout : 5 flags : Request A records reach : 0x00000000 (Not Reachable) order : 301000

DNS configuration (for scoped queries)

resolver #1 nameserver[0] : 10.0.1.2 nameserver[1] : 75.75.75.75 nameserver[2] : 10.0.1.1 if_index : 4 (en0) flags : Scoped, Request A records reach : 0x00030002 (Reachable,Local Address,Directly Reachable Address)

@server ~ % cat /etc/hosts

Host Database

#

localhost is used to configure the loopback interface

when the system is booting. Do not change this entry.

127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost

@server ~ % dig a app.ring.com

; <<>> DiG 9.10.6 <<>> a app.ring.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 11758 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;app.ring.com. IN A

;; Query time: 14 msec ;; SERVER: 75.75.75.75#53(75.75.75.75) ;; WHEN: Sat Jul 11 17:06:37 PDT 2020 ;; MSG SIZE rcvd: 41

@server ~ % dig aaaa app.ring.com

; <<>> DiG 9.10.6 <<>> aaaa app.ring.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 64361 ;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;app.ring.com. IN AAAA

;; Query time: 13 msec ;; SERVER: 75.75.75.75#53(75.75.75.75) ;; WHEN: Sat Jul 11 17:06:59 PDT 2020 ;; MSG SIZE rcvd: 41

doomstare commented 4 years ago

I don’t have firewall on and my ISP doesn’t provide ipv6

dxdc commented 4 years ago

It's your DNS server (Comcast). You can see it here:

; <<>> DiG 9.10.6 <<>> a app.ring.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: REFUSED, id: 11758
;

Also, it's very odd to me that you have 3 DNS entries, especially 2 local ones. Do you have some kind of double NAT issue with your router?

nameserver[0] : 10.0.1.2
nameserver[1] : 75.75.75.75
nameserver[2] : 10.0.1.1

What are the settings in your System Preferences -> Network -> (default network) -> DNS?

At a minimum, you should add Cloudflare or Google DNS. Comcast is not reliable:

(just one example)

dxdc commented 4 years ago

@dgreif a few other thoughts:

  1. Do you know why there was an ipv6 lookup when there was no ipv6 support?
  2. servers is a configurable cache lookup parameter. Maybe worth adding as an optional Ring config to use cloudflare DNS for example?

btw, @doomstare I wonder if there is a maximum amount of dns hits on ring.com which is why (maybe) you'd be getting throttled by Comcast.

doomstare commented 4 years ago

Went into network settings and there was old Comcast dns info saved. I don’t use Comcast anymore. Cleared the dns info so it would pull from the router and it appears everything is working now. Thank you for you’re help!

dxdc commented 4 years ago

Cleared the dns info so it would pull from the router and it appears everything is working now.

Glad it's fixed. You should still figure out why you're getting 2 different IP's for a local DNS (unless you had 2 entries loaded there). You don't need to have any DNS entries loaded in your Mac network settings, it will pull those automatically.

doomstare commented 4 years ago

Ya I cleared them all out. For some reason there were 3 ipv4 entries and almost a dozen ipv6 entries. I have my network default dns set to 1.1.1.1 and 1.0.0.1

washcroft commented 4 years ago

Just experienced something similar on my HomeBridge setup:

[Ring] Failed to reach Ring server at https://app.ring.com/rhq/v1/devices/v1/locations.  cacheableLookup ENOTFOUND app.ring.com.  Trying again in 5 seconds...
root@raspberrypi:~# cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi
root@raspberrypi:~# cat /etc/resolv.conf
# Generated by resolvconf
domain localdomain
nameserver 10.10.10.1
nameserver fe80::7a8a:20ff:fe7d:a4d1%eth0
root@raspberrypi:~# dig a app.ring.com

; <<>> DiG 9.11.5-P4-5.1+deb10u1-Raspbian <<>> a app.ring.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 903
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;app.ring.com.                  IN      A

;; ANSWER SECTION:
app.ring.com.           272     IN      CNAME   prdw-envproxy-use1.prd.rings.solutions.
prdw-envproxy-use1.prd.rings.solutions. 278 IN CNAME prdw-b-envproxy-use1.prd.rings.solutions.
prdw-b-envproxy-use1.prd.rings.solutions. 38 IN CNAME prdw-b-haproxy-use1-alb-342295508.us-east-1.elb.amazonaws.com.
prdw-b-haproxy-use1-alb-342295508.us-east-1.elb.amazonaws.com. 38 IN A 18.233.222.87
prdw-b-haproxy-use1-alb-342295508.us-east-1.elb.amazonaws.com. 38 IN A 52.44.72.224
prdw-b-haproxy-use1-alb-342295508.us-east-1.elb.amazonaws.com. 38 IN A 54.157.86.195

;; Query time: 0 msec
;; SERVER: 10.10.10.1#53(10.10.10.1)
;; WHEN: Thu Jul 16 17:51:24 BST 2020
;; MSG SIZE  rcvd: 270
root@raspberrypi:~# dig aaaa app.ring.com

; <<>> DiG 9.11.5-P4-5.1+deb10u1-Raspbian <<>> aaaa app.ring.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 48739
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;app.ring.com.                  IN      AAAA

;; ANSWER SECTION:
app.ring.com.           261     IN      CNAME   prdw-envproxy-use1.prd.rings.solutions.
prdw-envproxy-use1.prd.rings.solutions. 267 IN CNAME prdw-b-envproxy-use1.prd.rings.solutions.
prdw-b-envproxy-use1.prd.rings.solutions. 27 IN CNAME prdw-b-haproxy-use1-alb-342295508.us-east-1.elb.amazonaws.com.

;; Query time: 0 msec
;; SERVER: 10.10.10.1#53(10.10.10.1)
;; WHEN: Thu Jul 16 17:51:35 BST 2020
;; MSG SIZE  rcvd: 222

...clearing the DNS cache/getting a new DHCP lease/restarting the networking service didn't resolve the problem, only restarting HomeBridge itself did.

dxdc commented 4 years ago

@washcroft whats your version of node, npm, ring plugin, and hb?

Your dns config looks fine. Try adding debug to your ring config and posting back if it happens again. Upgrade your node to the latest v10/12 (not 11/13) if applicable.

washcroft commented 4 years ago

node v12.18.2 npm v6.14.5 homebridge v1.1.1 homebridge-ring v9.4.1 (have now updated to v9.6.0)

dxdc commented 4 years ago

Update your ring plugin. That should fix it!