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

UnhandledPromiseRejectionWarning: Error: invalid_grant #20

Open
pcjamesy opened this issue Feb 6, 2021 · 4 comments
Open

UnhandledPromiseRejectionWarning: Error: invalid_grant #20

pcjamesy opened this issue Feb 6, 2021 · 4 comments

Comments

@pcjamesy
Copy link

pcjamesy commented Feb 6, 2021

So i've been having this weird issue, each time that I set up the program it works for a few days, then I start to receive this error. I am able to download individual videos one at a time by running youtube-dl itself, but can't get the scrapper to run. I have reinstalled the system (whole os) and this error starts occurring again after a few days.

The system is: Ubuntu 18.04.5 LTS
youtube-dl --version 2021.02.04.1
nodejs --version v8.10.0

james@james:~$ sh ~/youtube-subscription-dl/yt-subs.sh 2021.02.04.1 (node:3024) UnhandledPromiseRejectionWarning: Error: invalid_grant at Gaxios.<anonymous> (/home/james/youtube-subscription-dl/node_modules/gaxios/build/src/gaxios.js:73:27) at Generator.next (<anonymous>) at fulfilled (/home/james/youtube-subscription-dl/node_modules/gaxios/build/src/gaxios.js:16:58) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) (node:3024) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:3024) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

@SPDUK
Copy link
Owner

SPDUK commented Feb 7, 2021

Weird. seems to be a known bug with google API https://blog.timekit.io/google-oauth-invalid-grant-nightmare-and-how-to-fix-it-9f4efaf1da35

Maybe that link will help, but it seems there's nothing I can do about it, I am assuming it's hitting the API limit - if you check your Google dashboard it should show how much usage you've used, the free tier is "okay" but if you have like ~500 subscriptions it would easily hit the limit

@pcjamesy
Copy link
Author

pcjamesy commented Feb 8, 2021

Running the script when receiving the error doesn't even seam to hit the api request counter when it gives an error, and it only reports 5000 (I should specify I'm not over the daily limit. One run for me takes around 400 requests) requests over the last 30 days so I don't think it is that. This is the third round of it breaking, and I suppose the main thing I have changed about how I use the scripts is moving from a vps to a local hyper-v machine. Off to see if virtual box treats me better.

@pcjamesy
Copy link
Author

After one week of running inside virtualbox it stopped working on the 7th day, but on the same system under a different user account i'm able to run the program after reauthenticating with the same client_secret.json .

So now my question is, how would I go about the reauthenticating process under the same user account on virtual box? I tired removing the file in .credentials and that still results in the invalid_grant error. It's just strange, since when I create a new user account it works.

Error confirming youtube API key Error while trying to retrieve access token invalid_grant

@wheelbarrow
Copy link

I've come across this too and belive it's to do with the key generated by google where they timeout after 7days. I didn't have this issue with a google apps acount. I havn't yet worked out how to get around this 7 days time out. I have even followed this info from google developers but it didn't work. https://www.youtube.com/watch?v=hfWe1gPCnzc&ab_channel=GoogleDevelopers as that timed out after an hour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants