Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notion integration needs reauthentication daily #113601

Closed
jum0n opened this issue Mar 16, 2024 · 19 comments · Fixed by #114787
Closed

Notion integration needs reauthentication daily #113601

jum0n opened this issue Mar 16, 2024 · 19 comments · Fixed by #114787
Assignees

Comments

@jum0n
Copy link

jum0n commented Mar 16, 2024

The problem

Notion integration needs reauthentication daily. Previously, with core-2024.3.0, the integration was broken and would not authenticate but after installing 2024.3.1 authentication worked, but periodically needs re-authentication (so far less than 1 day).

What version of Home Assistant Core has the issue?

core-2024.3.1

What was the last working version of Home Assistant Core?

core-2024.2.5

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Notion

Link to integration documentation on our website

https://www.home-assistant.io/integrations/notion

Diagnostics information

Found an error from the authentication dialogue:

Translation Error: The intl string context variable "name" was not provided to the string "Authentication expired for {name}"

Example YAML snippet

No response

Anything in the logs that might be useful for us?

No response

Additional information

No response

@home-assistant
Copy link

Hey there @bachya, mind taking a look at this issue as it has been labeled with an integration (notion) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of notion can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign notion Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


notion documentation
notion source
(message by IssueLinks)

@bachya
Copy link
Contributor

bachya commented Mar 16, 2024

I've been running 2024.3.1 since it was released and haven't seen this problem reoccur; I'll keep an eye out. In the meantime, if you could provide actual diagnostics and debug level logs, that may reveal something.

@jum0n
Copy link
Author

jum0n commented Mar 16, 2024

Perhaps its only a problem for me somehow. I've re-authenticated and enabled debug logging (waiting). Attached diagnostics.
config_entry-notion-7d95ccc13ab8802534e664b11ffb8e61.zip

@AdamGit69
Copy link

I am having the same issues still on 2024.3.1. Mine seems to be failing reauthentication once every 6 or so hours. It may be a connection issue as others are having reauthentication issues with other integrations? #113481 ?

@jum0n
Copy link
Author

jum0n commented Mar 19, 2024

No more issues over the past 3 days, I'm guessing whatever was causing the re-auths solved itself.

@Valdorama
Copy link

I'm having a different problem whereby the integration will not work at all (can't reauthenticate). The error is (email redacted):

Logger: homeassistant.config_entries
Source: config_entries.py:504
First occurred: 08:12:50 (3 occurrences)
Last logged: 15:10:53

Error setting up entry xxx@xxx.xxx for notion
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/notion/__init__.py", line 184, in async_setup_entry
    if (token := client.refresh_token) and token != entry.data[CONF_REFRESH_TOKEN]:
                                                    ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
KeyError: 'refresh_token'

@bachya
Copy link
Contributor

bachya commented Mar 19, 2024

@Valdorama That code no longer exists in the codebase. What version are you using?

@Valdorama
Copy link

Valdorama commented Mar 19, 2024

I'm using 2024.3.1

Edit: just pulled the latest HA image and restarted and still getting that error.

@bachya
Copy link
Contributor

bachya commented Mar 20, 2024

I see: this was fixed in #112832, which is slated for 2024.3.2.

@Valdorama
Copy link

Just upgraded to 2024.3.3 now that it's available, and still getting the same error. Anyone else getting it? Does the config need to be redone altogether? i.e. delete existing hub and add it again...

@bionicao
Copy link

Getting a similar error on 2024.3.3

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/config_entries.py", line 504, in async_setup
result = await component.async_setup_entry(hass, self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/notion/init.py", line 173, in async_setup_entry
if entry.data[key] == value:
~~~~~~~~~~^^^^^
KeyError: 'refresh_token'

@jum0n
Copy link
Author

jum0n commented Mar 25, 2024

I'm having the same re-auth issues since the update to 2024.3.3.

@Valdorama
Copy link

Is there a way to get this working temporarily until a fix is available?

@bachya
Copy link
Contributor

bachya commented Mar 27, 2024

Please update to the 2024.4.0 beta and see if it resolves the issue.

@Valdorama
Copy link

Thanks, I'm happy to wait till next week for the release since it's fixed, and especially since it's a pretty huge release.

@Valdorama
Copy link

Updated to 2024.04 and still seem to be getting an error, albeit slightly different:

Logger: homeassistant.config_entries
Source: config_entries.py:551
First occurred: 16:37:37 (2 occurrences)
Last logged: 17:02:53

Error setting up entry xxx@xxx.xxx for notion
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 551, in async_setup
    result = await component.async_setup_entry(hass, self)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/notion/__init__.py", line 111, in async_setup_entry
    if entry.data[key] == value:
       ~~~~~~~~~~^^^^^
KeyError: 'refresh_token'

@Valdorama
Copy link

I know this is marked closed but after upgrading to 2024.4.1 it is still not working for me. The error is different though. I have tried deleting the hub altogether and adding it again. There is nothing in the HA logs anymore.

I turned on debug logging for the integration and now in the logs I see some messages from aionotion that seem to indicate that it is reading the right data for my account. But at the end of the log it says:

DEBUG (MainThread) [homeassistant.components.notion] Finished fetching xxx@yyy.zzz data in 0.386 seconds (success: False)

When I hover over the 'Failed setup, will retry' text on the integration page, I see this message popup:

image

@bachya
Copy link
Contributor

bachya commented Apr 5, 2024

That error is not something controllable by Home Assistant—a quick search suggests a Redis issue, which may be something in the Notion API itself.

@Valdorama
Copy link

In case it's useful for anyone else, at some point over the weekend the status changed from 'Failed setup, will retry' to 'Authentication expired'. After re-entering my Notion password, it started working again and seems to be fine now.

@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants