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

Failed to upload to g-drive due to 401 unauthorized #5

Open
denven opened this issue Nov 27, 2020 · 5 comments
Open

Failed to upload to g-drive due to 401 unauthorized #5

denven opened this issue Nov 27, 2020 · 5 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@denven
Copy link
Collaborator

denven commented Nov 27, 2020

It worked fine a few days ago, however, no files are uploaded to g-drive these days when I check google drive.

The bash scripts are running after reboot, I checked the upload script log, found many items as following:

WARNING: Fri Nov 27 02:10:58 PST 2020 : Can not send metadata of the file. Something happen. Trying to send metadata of the file again

And the log comes from code:

if grep -q "401 Unauthorized" ${gdrive_dir}tmp/lastFileMetadataInfo; then echo "WARNING: $(date) : Can not send metadata of the file. Token was expired. Trying to refresh token and send metadata again" renew_token else echo "WARNING: $(date) : Can not send metadata of the file. Something happen. Trying to send metadata of the file again" echo $(cat ${gdrive_dir}tmp/lastFileMetadataInfo) sleep 5 fi

So, why the unauthorized happened? does it need to re-do the whole google API authentication process after a reboot?

@roleoroleo
Copy link
Owner

I think it's a bug, I have the same problem.
I tried to fix it but I failed.
Unfortunately I didn't write the code and I don't know it very well.
I need help.

@roleoroleo roleoroleo added the help wanted Extra attention is needed label Nov 27, 2020
@denven
Copy link
Collaborator Author

denven commented Nov 29, 2020

I think it's a bug, I have the same problem.
I tried to fix it but I failed.
Unfortunately I didn't write the code and I don't know it very well.
I need help.

{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "File not found: 1-oWzNNm0j-TwEL28PAITsFnxD1zwAZM9.",
"locationType": "parameter",
"location": "fileId"
}
],
"code": 404,
"message": "File not found: 1-oWzNNm0j-TwEL28PAITsFnxD1zwAZM9."
}
}

@denven
Copy link
Collaborator Author

denven commented Nov 29, 2020

I think it's a bug, I have the same problem.
I tried to fix it but I failed.
Unfortunately I didn't write the code and I don't know it very well.
I need help.

This shell script is not easy to maintain as it uses several global variables among functions, and many infinite loop. There are several bugs inside, some abnormal operation may trigger new issues.

This issue is caused by user deletion of directories in google drive, the script fails to upload to the deleted directory and runs into a dead loop, so it fails all the time.

Please add me as a committer, I've fixed on my own camera, hope there is no side-effect to other features.

@roleoroleo
Copy link
Owner

Thank you for your code.

@denven
Copy link
Collaborator Author

denven commented Nov 30, 2020

Thank you for your code.

Glad to commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants