sabeechen / hassio-google-drive-backup

Automatically create and sync Home Assistant backups into Google Drive
MIT License
3.19k stars 197 forks source link

Couldn't Refresh Google Drive Credentials #450

Closed lucabranda closed 3 years ago

lucabranda commented 3 years ago
Description:
The addon suddenly stopped working, I’ve already tried Re-authenticating but with no success.

Addon version: 0.104.3 Home Assistant Version: 2021.8.7 Supervisor Version: 2021.06.8 Supervisor Channel: stable Hassos Version: 6.2 Docker Version: 20.10.6 Architecture: aarch64 Machine: raspberrypi4-64 Date: 2021-08-25T08:42:18.089273+00:00 Timezone: Europe/Rome Failure Time: 2021-08-25T08:42:12.750506+00:00 Last Good Sync: 2021-08-25T08:42:12.281715+00:00

Exception:

  addon/backup/model/coordinator.py:176 (_sync)
  addon/backup/model/model.py:167 (sync)
  addon/backup/model/model.py:261 (_syncSnapshots)
  addon/backup/drive/drivesource.py:110 (get)
  addon/backup/drive/driverequests.py:179 (query)
  addon/backup/drive/driverequests.py:340 (retryRequest)
  addon/backup/drive/driverequests.py:94 (_getHeaders)
  addon/backup/drive/driverequests.py:139 (getToken)
  addon/backup/creds/exchanger.py:84 (refresh)
  addon/backup/creds/exchanger.py:124 (_refresh_default)
backup.exceptions.exceptions.CredRefreshGoogleError: Couldn't refresh your credentials with Google because: 'unauthorized_client'

Snapshots:

 {
    "HomeAssistant": {
        "snapshots": 4,
        "retained": 0,
        "deletable": 4,
        "name": "HomeAssistant",
        "title": "Home Assistant",
        "latest": "2021-08-24T00:01:04Z",
        "max": 4,
        "enabled": true,
        "icon": "home-assistant",
        "ignored": 0,
        "size": "242.1 MB",
        "ignored_size": "0.0 B",
        "free_space": "22.8 GB"
    },
    "GoogleDrive": {
        "snapshots": 4,
        "retained": 0,
        "deletable": 4,
        "name": "GoogleDrive",
        "title": "Google Drive",
        "latest": "2021-08-24T00:01:04Z",
        "max": 15,
        "enabled": true,
        "icon": "google-drive",
        "ignored": 0,
        "size": "242.1 MB",
        "ignored_size": "0.0 B",
        "free_space": "8.4 GB"
    }
}
Config:
 {
    "Setting.MAX_SNAPSHOTS_IN_GOOGLE_DRIVE": 15,
    "Setting.DAYS_BETWEEN_SNAPSHOTS": 1.0,
    "Setting.IGNORE_OTHER_SNAPSHOTS": true,
    "Setting.SNAPSHOT_TIME_OF_DAY": "02:00",
    "Setting.SEND_ERROR_REPORTS": true
}
Addon Logs:
 08-25 10:36:19 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/core/info
08-25 10:36:19 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/supervisor/info
08-25 10:38:37 INFO [backup.model.coordinator] Syncing Snapshots
08-25 10:38:37 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots
08-25 10:38:37 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:38:38 DEBUG [backup.drive.drivesource] Unable to retrieve Google Drive storage info: Couldn't refresh your credentials with Google because: 'unauthorized_client'
08-25 10:38:38 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:38:38 ERROR [backup.model.coordinator] Couldn't refresh your credentials with Google because: 'Couldn't refresh your credentials with Google because: 'unauthorized_client''
08-25 10:38:38 INFO [backup.model.coordinator] I'll try again in an hour
08-25 10:39:03 INFO [backup.model.coordinator] Syncing Snapshots
08-25 10:39:03 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots
08-25 10:39:03 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:39:03 DEBUG [backup.drive.drivesource] Unable to retrieve Google Drive storage info: Couldn't refresh your credentials with Google because: 'unauthorized_client'
08-25 10:39:03 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:39:03 ERROR [backup.model.coordinator] Couldn't refresh your credentials with Google because: 'Couldn't refresh your credentials with Google because: 'unauthorized_client''
08-25 10:39:03 INFO [backup.model.coordinator] I'll try again in an hour
08-25 10:40:26 INFO [backup.model.coordinator] Syncing Snapshots
08-25 10:40:26 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots
08-25 10:40:26 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:40:27 DEBUG [backup.drive.drivesource] Unable to retrieve Google Drive storage info: Couldn't refresh your credentials with Google because: 'unauthorized_client'
08-25 10:40:27 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:40:27 ERROR [backup.model.coordinator] Couldn't refresh your credentials with Google because: 'Couldn't refresh your credentials with Google because: 'unauthorized_client''
08-25 10:40:27 INFO [backup.model.coordinator] I'll try again in an hour
08-25 10:42:12 INFO [backup.model.coordinator] Syncing Snapshots
08-25 10:42:12 DEBUG [backup.ha.harequests] Making Hassio request: http://hassio/snapshots
08-25 10:42:12 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:42:12 DEBUG [backup.drive.drivesource] Unable to retrieve Google Drive storage info: Couldn't refresh your credentials with Google because: 'unauthorized_client'
08-25 10:42:12 DEBUG [backup.drive.driverequests] Requesting refreshed Google Drive credentials
08-25 10:42:12 ERROR [backup.model.coordinator] Couldn't refresh your credentials with Google because: 'Couldn't refresh your credentials with Google because: 'unauthorized_client''
08-25 10:42:12 INFO [backup.model.coordinator] I'll try again in an hour
Supervisor Logs:
 21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_nodered
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:01 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:03 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request initialize
21-08-25 10:40:03 INFO (MainThread) [supervisor.api.proxy] WebSocket access from a0d7b954_vscode
21-08-25 10:40:03 INFO (MainThread) [supervisor.api.proxy] Home Assistant WebSocket API request running
21-08-25 10:40:09 INFO (MainThread) [supervisor.snapshots] Found 4 snapshot files
21-08-25 10:40:09 INFO (MainThread) [supervisor.snapshots] Found 4 snapshot files
21-08-25 10:40:26 INFO (MainThread) [supervisor.api.middleware.security] /snapshots access from cebe7a76_hassio_google_drive_backup
21-08-25 10:42:12 INFO (MainThread) [supervisor.api.middleware.security] /snapshots access from cebe7a76_hassio_google_drive_backup
21-08-25 10:42:18 INFO (MainThread) [supervisor.api.middleware.security] /supervisor/logs access from cebe7a76_hassio_google_drive_backup
Home Assistant Core Logs:
 [s6-finish] waiting for services.
2021-08-25 10:39:24 ERROR (MainThread) [homeassistant.components.hassio.handler] Timeout on /homeassistant/restart request
Initialized switch [Interruttore sala (locale)]
Initialized switch [Switch 2 sala (locale)]
Initialized switch [Switch 3 sala (locale)]
Initialized switch [Switch 1 cucuna]
Initialized switch [Switch 2 cucina]
Initialized switch [Luce esterna]
s6-svscanctl: fatal: unable to control /var/run/s6/services: supervisor not listening
[s6-finish] sending all processes the TERM signal.
[s6-finish] sending all processes the KILL signal and exiting.
[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] udev.sh: executing... 
[cont-init.d] udev.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
2021-08-25 10:39:37 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-25 10:39:37 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration alexa_media which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-25 10:39:37 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration localtuya which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-25 10:39:37 WARNING (SyncWorker_4) [homeassistant.loader] We found a custom integration gismeteo which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-25 10:39:37 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration sonoff which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-08-25 10:39:51 WARNING (MainThread) [homeassistant.setup] Setup of influxdb is taking over 10 seconds.
2021-08-25 10:39:56 ERROR (SyncWorker_1) [homeassistant.components.influxdb] Cannot connect to InfluxDB due to 'HTTPConnectionPool(host='a0d7b954-influxdb', port=8086): Max retries exceeded with url: /write?db=PirupiruDB (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7faa7fa5b0>: Failed to establish a new connection: [Errno -3] Try again'))'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.
2021-08-25 10:41:12 ERROR (SyncWorker_1) [homeassistant.components.influxdb] Cannot connect to InfluxDB due to 'HTTPConnectionPool(host='a0d7b954-influxdb', port=8086): Max retries exceeded with url: /write?db=PirupiruDB (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f9f260760>: Failed to establish a new connection: [Errno -3] Try again'))'. Please check that the provided connection details (host, port, etc.) are correct and that your InfluxDB server is running and accessible. Retrying in 60 seconds.
sabeechen commented 3 years ago

I'm not sure what could be causing this error. Are you using custom credentials with Google Drive (eg did you previously use these instructions when installing the addon)? If so, you may need to go through the instructions and make sure all the necessary steps are followed, credentials like that are pretty fragile.

If not, then this is much more mysterious. I'd restart the addon if you haven't already, as there is the potential this is caused by caching some DNS settings I modified for the addon's cloud server a few days ago. When did you install the addon, and did you do anything else with the addon around the time it failed (eg updating settings)?

lucabranda commented 3 years ago

I restarted Home assistant, increased the maximum snapshots in Drive, re authenticated and it started working again. The issue presented itself when, while I was on holiday, the maximum number of drive snapshots was reached.

sabeechen commented 3 years ago

I'm going to close this issue for now, but please feel free to re-open it if you think there is something else I can help with.