Google Calendar - errors

System: HA Core 2021.1.5 on Docker.

Issue: Google Calendar not loading.

Description:
Since 2 days my Google calendars are no longer loading into HA, with below error.
There has absolutely not been any configuration change on my side.

Are other people also experiencing issues with Google calendar integration ?
Any clue on how I can solve this ?

Thx in anticipation !

PS: Deleting or renaming the file “.google.token” in your /config folder & rebooting is just a temporary fix. There is something more fundamental going wrong with this integration.

Error:

Logger: homeassistant.core
Source: components/google/__init__.py:347
First occurred: 10:16:26 AM (1 occurrences)
Last logged: 10:16:26 AM
Error executing service: <ServiceCall google.scan_for_calendars (c:37f1319fe7b5644911ad8cb60e28c674)>

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1461, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1484, in _execute_service
    await self._hass.async_add_executor_job(handler.job.target, service_call)
  File "/usr/local/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 257, in _scan_for_calendars
    service = calendar_service.get()
  File "/usr/src/homeassistant/homeassistant/components/google/__init__.py", line 347, in get
    http = credentials.authorize(httplib2.Http())
AttributeError: 'NoneType' object has no attribute 'authorize'

I got the same problem. Removing the token file just fixes it for a short period then the error comes back.

Thanks for the confirmation, Patrik.

I’d like to understand how we can raise this issue to the owner(s) of this integration.

+1
How does this get fixed? there seems to be no way to officiailly report an error with the standard HA integrations.

Ok the error is happening in this piece of code:

 class GoogleCalendarService:
    """Calendar service interface to Google."""

    def __init__(self, token_file):
        """Init the Google Calendar service."""
        self.token_file = token_file

    def get(self):
        """Get the calendar service from the storage file token."""
        credentials = Storage(self.token_file).get()
        http = credentials.authorize(httplib2.Http())
        service = google_discovery.build(
            "calendar", "v3", http=http, cache_discovery=False
        )
        return service

The line giving the error is:

http = credentials.authorize(httplib2.Http())

So it’s confirmed as an OAuth failure at the Google end using the saved token file.

Google Search throws up not much, but maybe something useful here: https://github.com/omab/python-social-auth/issues/989

Thanks for looking into this Connor.

We need to get this to the attention of the integration owner, or the HA core people.
I don’t know how to get this done.

I’m having the same issue here as well.