assistant-relay icon indicating copy to clipboard operation
assistant-relay copied to clipboard

Getting metadata from plugin failed with error: invalid_grant

Open HeedfulCrayon opened this issue 4 years ago • 74 comments

Describe the bug Assistan relay seems to lose auth after a while. Whenever testing anything in sandbox I get this error: Getting metadata from plugin failed with error: invalid_grant

To Reproduce Steps to reproduce the behavior: Try any command in sandbox

Expected behavior Command or broadcast to occur without issue.

Desktop (please complete the following information):

  • Platform Pi 4 running home assistant
  • Browser vivaldi
  • Version latest

HeedfulCrayon avatar Dec 26 '20 01:12 HeedfulCrayon

I just got exactly the same issue. its been working for about a week. I had to create another user using the same OAuth client ID. why is that?

jayhohoho2019 avatar Dec 27 '20 19:12 jayhohoho2019

Also seeing this issue

jesselumarie avatar Dec 29 '20 04:12 jesselumarie

Same issue, and also solved by creating a new user using the same credentials.

littlbee avatar Dec 29 '20 08:12 littlbee

Creating a new user only fixes it temporarily. After a few days it will go back to doing the same thing

HeedfulCrayon avatar Dec 29 '20 16:12 HeedfulCrayon

Yep that’s what I ran into

On Dec 29, 2020, at 08:10, HeedfulCrayon [email protected] wrote:

 Creating a new user only fixes it temporarily. After a few days it will go back to doing the same thing

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

jesselumarie avatar Dec 29 '20 22:12 jesselumarie

Also getting this, going to try running a command to ask the time every six hours to see if that stops any timeout.

matt---4 avatar Jan 02 '21 18:01 matt---4

Happening to me again, 7 days after. Who is causing this to expire? GAR or Google?

jayhohoho2019 avatar Jan 04 '21 01:01 jayhohoho2019

Same for me. @matt---4 Any luck with your testing to repeat a command every X hours?

thomasbonte avatar Jan 05 '21 13:01 thomasbonte

So far the issue hasn't happened since I started asking the time every six hours. I'll post back on here in a week or so with another update or if the issue happens again.

matt---4 avatar Jan 06 '21 10:01 matt---4

@matt---4 ok good to know! I'll be testing this myself as well.

thomasbonte avatar Jan 06 '21 14:01 thomasbonte

I'm having the same issue and have automations which run daily at minimum firing commands. All working fine until 4 days ago with nothing having changed but now with the invalid_grant error. Same happens if I fire from sandbox mode.

EDIT - FYI I also added a new user using the same auth creds and it works again with this new user. I will monitor to whether this user gets impacted over time

Snacker001 avatar Jan 06 '21 18:01 Snacker001

me 3

abdalians avatar Jan 09 '21 05:01 abdalians

I'm a bit concerned the dev doesn't seem to react on this issue... Is there anyone still maintaining this code ?

littlbee avatar Jan 09 '21 09:01 littlbee

I'm a bit concerned the dev doesn't seem to react on this issue... Is there anyone still maintaining this code ?

Calm down, last commit was 14 days ago. Just set up an automation to run every 6 hours like stated above and you won't lose auth. Mines been working fine for over a week

HeedfulCrayon avatar Jan 11 '21 16:01 HeedfulCrayon

Not sure the regular automation trick works. I set up a new user to prevent the problem on the current user, set up an automation to run every 5 hours. It was fine for the first day and now is failing with the invalid_grant error again

Snacker001 avatar Jan 14 '21 07:01 Snacker001

My raspberry pi crashed and I got invalid grant when it started up again. So I don't know how long the automation thing would have worked for.

matt---4 avatar Jan 14 '21 09:01 matt---4

Both my users lost the grant at the same time, one was used much more frequently than the other so I doubt it is interaction dependent. It was also 7 days after I set the system up.

Is there maybe something with the testing function that are used for the grants?

matteskonto avatar Jan 14 '21 11:01 matteskonto

Just saying, mine is still going just fine

HeedfulCrayon avatar Jan 14 '21 16:01 HeedfulCrayon

@HeedfulCrayon that's good. What environment are you using this in? For me I am using the Home Assistant add-on and triggering automations through node-red. Curiously at the moment I get the error only in node-red, but can still successfully use the sandbox mode to trigger directly on the latest user account. My original user account fails in both Node-red and sandbox.

I might try installing a separate instance on a VM and see how that goes.

Snacker001 avatar Jan 14 '21 16:01 Snacker001

@Snacker001 I am using it in the Home Assistant add-on and I am using the native yaml automations:

id: 'google_assistant_relay_heartbeat'
alias: Google Assistant Relay Heartbeat
description: 'Keeps the token for Google Assistant Relay Alive'
trigger:
  platform: time
  at:
    - "09:30:00"
    - "12:00:00"
    - "18:00:00"
    - "00:00:00"
    - "06:00:00"
action:
  - service: rest_command.assistant_relay
    data:
      command: What time is it?

HeedfulCrayon avatar Jan 14 '21 21:01 HeedfulCrayon

Don't think this is a GAR problem. I am not seeing any problem running in Docker on Ubuntu. It can be days between broadcasts and I'm not having any problems.

ryancasler avatar Jan 15 '21 00:01 ryancasler

I see the same behavior

mbaluda avatar Jan 17 '21 23:01 mbaluda

I'm having the same issue. Have not been tracking but would guess I loose grant after about 4 days. Will set up automation to track this more closely.

peterolby avatar Jan 18 '21 10:01 peterolby

Mine finally died. Looks like running an automation periodically doesn't seem to fix the issue

HeedfulCrayon avatar Jan 19 '21 03:01 HeedfulCrayon

I ran into the same problem twice now, it does not appear to be related to lack of activity. I'm posting in case my experiences help narrow down the problem.

The first failure, my Pi lost power hard and didn't boot back up properly. After solving the boot problem, I still received the invalid_grant errors. I didn't do any other testing, I reloaded the OS on the Pi and started over.

The second time, last night, I was actively sending commands when the credentials began failing. I sent 475 commands in 1 day successfully and began receiving the invalid_grant error on the 476th command.

The Google Assistant API reported "1 of 1 quota is reaching limit", the quota is 500 requests per day so I was near it.

I confirmed Google reported the Assistant API quota reset overnight, but I was still getting the same invalid_grant response this morning. I created a new Assistant-Relay user with no other issues to temporarily mitigate the problem.

wolfet410 avatar Jan 19 '21 15:01 wolfet410

What environment are you running GAR in? I am running in a plain Linux Alpine based Docker container and I am not having this problem. I would look more at what your OS might be contributing to this. If it was a GAR problem, we would all be seeing it.

ryancasler avatar Jan 20 '21 00:01 ryancasler

I've been having the same issues. I thought it was occurring every 7 days for me (Sunday to Sunday) but I lost it again today after really 2 day, after I had also set up another webCoRE piston to ping every 5 hours. I'm on a Ubuntu vm on vmware running on a Windows 10 host. And I don't think I would have hit the 500 requests per day limit. This is getting really annoying.

jayhohoho2019 avatar Jan 20 '21 03:01 jayhohoho2019

Has this problem a few times when deploying AR via the Hassio add-on. Since moving it to run on a VM running ubuntu18.04 it has not reoccurred.

For what it's worth I have a benign automation running every 5 hours, but I am not sure that really helps - it certainly didn't when running the hassio add-on. I am also nowhere near the 500 per day request rate.

Snacker001 avatar Jan 20 '21 09:01 Snacker001

I do not think the problem is only caused by exceeding the quota.

Just speculation, but it seems once the invalid_grant error appear for whatever different reason it does not recover until a new user is created. Even if the root cause of the invalid_grant error gets solved (i.e. timeout no longer occurs, quota has expired, etc) that user won't stop reporting a failure. Problems like timeouts or disconnects that occur for reasons completely unrelated to GAR, and would normally be solved by sending another request, ultimately stop the service until manual intervention.

If that's the case, I agree a more powerful server would have less of a chance of initial failure avoiding this issue altogether.

wolfet410 avatar Jan 20 '21 13:01 wolfet410

I too am encountering this issue. GAR v3.2.0 running on Win10.

FaberOptime avatar Jan 20 '21 14:01 FaberOptime