bropat / eufy-security-client

This shared library allows to control Eufy security devices by connecting to the Eufy cloud servers and local/remote stations over p2p.
MIT License
508 stars 75 forks source link

Push notification registration fails #459

Closed martijnpoppen closed 10 months ago

martijnpoppen commented 10 months ago

Client version

Develop

Node version

18

Operating System type

Other

Operating system version

10

Describe the bug

Hi bropat I have some users on Homey who report that they dont receive notification info. After receiving their logs i see the following:


[EufyLibrary] Retry to register/login for push notification
[EufyLibrary] Push notification connection closed
[EufyLibrary] Retry to register/login for push notification in 20 seconds...
[log] [Device] homebase2 - CMD_SET_ARMING => CMD_SET_ARMING
[EufyLibrary] Retry to register/login for push notification
[EufyLibrary] Push notification connection closed
[EufyLibrary] Retry to register/login for push notification in 30 seconds...

    stderr:
            stringifyJson: [Function: stringify],
        retry: {
          limit: 3,
          methods: [ 'POST' ],
          statusCodes: [
            408, 413, 429, 500,
            502, 503, 504, 521,
            522, 524
          ],
          errorCodes: [
            'ETIMEDOUT',
            'ECONNRESET',
            'EADDRINUSE',
            'ECONNREFUSED',
            'EPIPE',
            'ENOTFOUND',
            'ENETUNREACH',
            'EAI_AGAIN'
          ],
          maxRetryAfter: undefined,
          calculateDelay: [Function: calculateDelay],
          backoffLimit: Infinity,
          noise: 100
        },
        localAddress: undefined,
        method: 'POST',
        createConnection: undefined,
        cacheOptions: {
          shared: undefined,
          cacheHeuristic: undefined,
          immutableMinTimeToLive: undefined,
          ignoreCargoCult: undefined
        },
        https: {
          alpnProtocols: undefined,
          rejectUnauthorized: undefined,
          checkServerIdentity: undefined,
          certificateAuthority: undefined,
          key: undefined,
          certificate: undefined,
          passphrase: undefined,
          pfx: undefined,
          ciphers: undefined,
          honorCipherOrder: undefined,
          minVersion: undefined,
          maxVersion: undefined,
          signatureAlgorithms: undefined,
          tlsSessionLifetime: undefined,
          dhparam: undefined,
          ecdhCurve: undefined,
          certificateRevocationLists: undefined
        },
        encoding: undefined,
        resolveBodyOnly: false,
        isStream: false,
        responseType: 'json',
        url: URL {
          href: 'https://firebaseinstallations.googleapis.com/v1/projects/batterycam-3250a/installations',
          origin: 'https://firebaseinstallations.googleapis.com',
          protocol: 'https:',
          username: '',
          password: '',
          host: 'firebaseinstallations.googleapis.com',
          hostname: 'firebaseinstallations.googleapis.com',
          port: '',
          pathname: '/v1/projects/batterycam-3250a/installations',
          search: '',
          searchParams: URLSearchParams {},
          hash: ''
        },
        pagination: {
          transform: [Function: transform],
          paginate: [Function: paginate],
          filter: [Function: filter],
          shouldContinue: [Function: shouldContinue],
          countLimit: Infinity,
          backoff: 0,
          requestLimit: 10000,
          stackAllItems: false
        },
        setHost: true,
        maxHeaderSize: undefined,
        signal: undefined,
        enableUnixSockets: false
      }
    },
    message: 'FidRegistrationFailedError: FID registration failed',
    context: { fid: 'eASQfREDACTED' },
    stacktrace: 'FidRegistrationFailedError: FID registration failed\n' +
      '    at PushNotificationService.registerFid (/app/node_modules/eufy-security-client/build/push/service.js:136:19)\n' +
      '    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
      '    at async PushNotificationService.createPushCredentials (/app/node_modules/eufy-security-client/build/push/service.js:200:16)\n' +
      '    at async PushNotificationService._open (/app/node_modules/eufy-security-client/build/push/service.js:646:32)\n' +
      '    at async PushNotificationService.open (/app/node_modules/eufy-security-client/build/push/service.js:708:13)\n' +
      '    at async Timeout._onTimeout (/app/node_modules/eufy-security-client/build/push/service.js:718:21)'
  },
  credentials: undefined,
  renew: false
}
[EufyLibrary] Push notifications are disabled, because the registration failed! { credentials: undefined, renew: false

I hope you have any tips ;)

To reproduce

Unkown

Screenshots & Logfiles

No response

Additional context

No response

bropat commented 10 months ago

Hi @martijnpoppen,

the above log seems to be incomplete. Nevertheless, an error in this source code area is usually caused by an ad blocker such as pi-hole or adguard blocking the DNS query on firebaseinstallations.googleapis.com by returning 0.0.0.0.0 as the IP address. This results in this error message (ECONNREFUSED).

thoflo-utd commented 10 months ago

I am one of the users. There is no such thing installed. I have no adblocker nor pi-hole.

PhilippEngler commented 10 months ago

Another hint: are the users having problems with push connection using ipv6 for internet connection? It seems that the firebaseinstallations-server have sometimes problems with ipv6.