motioneyeos icon indicating copy to clipboard operation
motioneyeos copied to clipboard

Dropbox uploads fail after a few hours: "code doesn't exist or has expired"

Open mikestefanello opened this issue 2 years ago • 18 comments

motionEyeOS Version

I am running motionEyeOS version: 20200606

Board Model

Raspberry PI 2

Camera

Amcrest 1080p USB Webcam (https://www.amazon.com/gp/product/B08FCQY62D/)

Network Connection

My motionEyeOS unit is connected to the network via WiFi

Log Files

Exception: code doesn't exist or has expired
2022-02-20 16:00:32: [motioneye]    ERROR: dropbox: refreshing credentials failed
2022-02-20 16:00:32: [motioneye]    ERROR: failed to upload file "/data/output/Camera1/2022-02-20/16-00-00.jpg" with service dropbox: code doesn't exist or has expired
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 1103, in upload_media_file
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 103, in upload_file
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 726, in upload_data
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 782, in _request
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 827, in _request_credentials
Exception: code doesn't exist or has expired
2022-02-20 16:15:31: [motioneye]    ERROR: dropbox: refreshing credentials failed
2022-02-20 16:15:31: [motioneye]    ERROR: failed to upload file "/data/output/Camera1/2022-02-20/16-15-00.jpg" with service dropbox: code doesn't exist or has expired
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 1103, in upload_media_file
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 103, in upload_file
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 726, in upload_data
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 782, in _request
  File "/usr/lib/python2.7/site-packages/motioneye/uploadservices.py", line 827, in _request_credentials
Exception: code doesn't exist or has expired
2022-02-20 16:27:07: [motioneye]  WARNING: 403 GET /login/?_=1645392427224&_username=_&_signature=f4bbab00c2f83ab1e265b376664353b5dc028f15 (192.168.68.109) 7.73ms

Problem

I setup photos to be taken every 15 minutes. I enabled uploading to Dropbox. After authorizing and entering the code, the uploads work fine. After a few hours, they stop, and I see the logs pasted above. I've been able to reproduce this twice in a row (the only times I've tried).

mikestefanello avatar Feb 20 '22 21:02 mikestefanello

Please try dev20201026

starbasessd avatar Feb 20 '22 21:02 starbasessd

@starbasessd Is there an easy way to upgrade or do I have to flash the card?

mikestefanello avatar Feb 20 '22 22:02 mikestefanello

Here Be Dragons

Backup your current installation: Settings, General, Backup Then Settings, Expert, Enable Prereleases Apply Then Settings, General, Software Update, and follow the prompts. If it corrupts (it happens occasionally) then re-image, and do the restore.

starbasessd avatar Feb 20 '22 22:02 starbasessd

Thanks. I completely missed the "Enable Prereleases" option.

I'll run that now, re-configure Dropbox, and let it export until tomorrow to see if it holds up. I'll report back. Thanks again for the help.

mikestefanello avatar Feb 20 '22 22:02 mikestefanello

Same exact problem. It worked for about 4 hours.

mikestefanello avatar Feb 21 '22 12:02 mikestefanello

Are you on a free plan, or paid?

starbasessd avatar Feb 21 '22 13:02 starbasessd

Free

mikestefanello avatar Feb 21 '22 14:02 mikestefanello

Are you saving movie files, or snapshots, or both? What is the total file size saved when it stops working? I've never run into a limitation (I have a 'free' account, but I only do 1 camera for testing, and never exceed 50GB/day. I've run into more issues with GDrive (with number of files rather than size of files) but still prefer it over dropbox.

starbasessd avatar Feb 21 '22 14:02 starbasessd

Only snapshots. The files are about 1.6mb in size each. I'm doing 1 every 15 minutes. The free plan has 2gb and I have nothing else in it. There's less than 100mb in total usage around the time it stops working (~4 hours). If it was a space issue, would the error still be ERROR: dropbox: refreshing credentials failed?

mikestefanello avatar Feb 21 '22 14:02 mikestefanello

Found a post on dropbox forums about this same 4 hour token expiry issue.

"Dropbox is migrating to issuing only short-lived access tokens (and optional refresh tokens) instead of long-lived access tokens."

More info about it here

thenib avatar Mar 04 '22 06:03 thenib

@thenib Thank you very much for pointing this out. I will change this to 'enhancement'/'feature request' and we can hope when a dev takes over, it can be fixed. It should be able to be modded easier with motionEye, than motionEyeOS, as the system is more exposed to modification.

starbasessd avatar Mar 04 '22 12:03 starbasessd

I added a refresh_token method for dropbox: https://github.com/motioneye-project/motioneye/pull/2396

motzke avatar Mar 30 '22 06:03 motzke

Greetings! Thanks for the fixing pull request for this issue. I'm facing it currently too.

Is there an easy way of updating motioneye to the dev version under motioneyeOS? Or what would you recommend me to get this fix up and running?

When selecting "Enable PreReleases" and clicking on "Software Update: Check", I get the following error: "An error occurred. Refreshing is recommended."

Thanks for you help!

byWulf avatar Jun 11 '22 07:06 byWulf

https://github.com/motioneye-project/motioneyeos/issues/2886#issuecomment-1046332845

starbasessd avatar Jun 11 '22 07:06 starbasessd

Thanks for you quick answer @starbasessd . I have seen your post and tried it out, but as I wrote, this didn't work for me because of the error message "An error occurred. Refreshing is recommended." when checking for an update.

byWulf avatar Jun 11 '22 09:06 byWulf

Part 1 was backup, then run the check for updates. Part 2 was was re-image, then do the restore.

starbasessd avatar Jun 11 '22 11:06 starbasessd

The image is available here Be aware, though, the fix from https://github.com/motioneye-project/motioneyeos/issues/2886#issuecomment-1082692289 is not easily applied to motionEyeOS, only motionEye.

starbasessd avatar Jun 11 '22 11:06 starbasessd

Hi, Same problem with me ( i have motioneyeOS dev20201026) , i don't know if i a paid account will solve the issue ?

dba83 avatar Nov 19 '22 22:11 dba83