hermanho / MMM-GooglePhotos

Display your photos on MagicMirror from Google Photos.
MIT License
170 stars 65 forks source link

It wont load any images and I get UnhandledPromiseRejectionWarning in the logs #103

Closed pepeuDotCom closed 3 years ago

pepeuDotCom commented 3 years ago

It's been working for about a week with no issues. Started it up today again and got this in the logs.

[22.02.2021 16:57.16.989] [ERROR] (node:2591) UnhandledPromiseRejectionWarning: Error: invalid_grant at createError (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/google-auth-library/node_modules/axios/lib/core/createError.js:16:15) at settle (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/google-auth-library/node_modules/axios/lib/core/settle.js:18:12) at IncomingMessage.handleStreamEnd (/home/pi/MagicMirror/modules/MMM-GooglePhotos/node_modules/google-auth-library/node_modules/axios/lib/adapters/http.js:202:11) at IncomingMessage.emit (events.js:215:7) at endReadableNT (_stream_readable.js:1183:12) at processTicksAndRejections (internal/process/task_queues.js:80:21) [22.02.2021 16:57.16.990] [ERROR] (node:2591) 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: 2) [22.02.2021 16:57.16.991] [ERROR] (node:2591) [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.

Any ideas?

Cheers!

aneaville commented 3 years ago

I believe this is the same issue as issue #102 .

Try deleting the token.json file and rerunning the generate_token.js

pepeuDotCom commented 3 years ago

That worked. Thanks! But why would the token expire? I want it to run for eons without having to fiddle with it.

aneaville commented 3 years ago

Tokens expire after 1 hour, so that is to be expected. It renews the tokens when needed. I believe it uses the newly expired token as part of the info to get a new token(not 100% sure about that). Seems like it has issues if the token has been expired for a long time.

I believe most people have the pi restart every 1-3 days. I believe this make this issue no longer relative.