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

Auto clean failed with error #9

Open
denven opened this issue May 29, 2023 · 4 comments
Open

Auto clean failed with error #9

denven opened this issue May 29, 2023 · 4 comments
Assignees
Labels
bug Something isn't working resolved

Comments

@denven
Copy link
Owner

denven commented May 29, 2023

image

@denven
Copy link
Owner Author

denven commented Jun 1, 2023

When it started to clean spaces, it failed when some errors happened. Currently, it happened to my subscribed OneDrive account and works for my personal account
image

@denven
Copy link
Owner Author

denven commented Jun 1, 2023

image

from the error message, jq failed to index string "message", which means the api request returned non-desirable data which doesn't contain the path of error.message in function send_api_request() or refresh_oauth2_tokens(), and it may result in:

  • ./data/token.json file corrupted
  • get_percent() failure on the wrong calculation and starting auto_clean improperly

the following code cannot test if the variable ${total} is 0, it only tests if it is not empty. get_percent() has a chance to run into an exception error Division by zero

if [ ! -z ${total} ]; then 
	used_ratio=$(get_percent ${used} ${total})
	free_ratio=$(get_percent ${remaining} ${total})
else 
	continue
fi 

To fix this issue, we have to find what the API response looks like when it happens. Currently, wait for another time to reproduce and fix it.

@denven denven self-assigned this Jun 1, 2023
@denven denven added bug Something isn't working wait for reproduce labels Jun 1, 2023
@denven
Copy link
Owner Author

denven commented Jun 3, 2023

Sometimes, the refreshing access token will fail and leads to wrong and invalid data being written into the data/token.json file, checked MS OAuth2 API, the error message doesn't contain a nested 'errror.message' path, so fetching the error message by jq from this key path will break.

Once this API returns an error and continues, acces_token may fail to expire eventually, then manual re-authorization is required to fix this issue due to the continuous failure of refresh tokens.

@denven
Copy link
Owner Author

denven commented Jun 3, 2023

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working resolved
Projects
None yet
Development

No branches or pull requests

1 participant