thesamim / TickTickSync

GNU General Public License v3.0
98 stars 2 forks source link

Receiving 503 with Login Failed #142

Closed hicaylen closed 2 days ago

hicaylen commented 6 days ago

Hello,

I'm currently trying to login with a fresh install of TickTickSync. I see the following: image

I also see a bunch of Check point has been changed. as well.

Interestingly enough, I also saw a Bad JSON response. When I grabbed the JSON, I see a [Exception: SyntaxError: Unexpected token '<', "<html> <hj"... is not valid JSON at JSON.parse... in the json field.

This has been going on for a few days as far as I can tell.

Is it possible that TickTick changed their response in their API?

Thanks!

LemurTech commented 4 days ago

I saw a similar "503" message on my Android. I decided to troubleshoot the situation on my desktop. Sync wasn't working, but wasn't throwing an obvious error. In the console I see:

TickTick scheduled synchronization task started at 6/30/2024, 1:49:08 PM
plugin:tickticksync:12743 Bad JSON response
plugin:tickticksync:12744 Trying Text.
plugin:tickticksync:13013 Error get project groups Error: [object Object]
    at TickTickRestAPI.GetProjectGroups (plugin:tickticksync:13008:17)
    at async CacheOperation.saveProjectsToCache (plugin:tickticksync:21346:29)
    at async SyncMan.syncTickTickToObsidian (plugin:tickticksync:22824:19)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:23487:24)
    at async eval (plugin:tickticksync:23258:58)
GetProjectGroups @ plugin:tickticksync:13013
await in GetProjectGroups (async)
saveProjectsToCache @ plugin:tickticksync:21346
syncTickTickToObsidian @ plugin:tickticksync:22824
scheduledSynchronization @ plugin:tickticksync:23487
plugin:tickticksync:12743 Bad JSON response
plugin:tickticksync:12744 Trying Text.
plugin:tickticksync:13060 Error get all Tasks Error: No Results.
    at TickTickRestAPI.getAllTasks (plugin:tickticksync:13056:15)
    at async SyncMan.syncTickTickToObsidian (plugin:tickticksync:22830:28)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:23487:24)
    at async eval (plugin:tickticksync:23258:58)
getAllTasks @ plugin:tickticksync:13060
await in getAllTasks (async)
syncTickTickToObsidian @ plugin:tickticksync:22830
plugin:tickticksync:22948 An error occurred while synchronizing: TypeError: Cannot read properties of undefined (reading 'filter')
    at SyncMan.syncTickTickToObsidian (plugin:tickticksync:22847:45)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:23487:24)
    at async eval (plugin:tickticksync:23258:58)
syncTickTickToObsidian @ plugin:tickticksync:22948
plugin:tickticksync:23566 Task Sync/Work.md
plugin:tickticksync:23598 TickTick scheduled synchronization task completed at 6/30/2024, 1:49:10 PM

I've gone through my usual troubleshooting steps of clearing tasks and metadata, validating the JSON and attempting a resync.

ms3056 commented 4 days ago

Seems like things work fine - when I tinker with my Obsidian by turning plugins off and doing some testing, then turn this plugin on, then these issues seems to come up. Today I have this issue:

image

pplebel commented 3 days ago

FWIW, I am also getting this error

LemurTech commented 3 days ago

Same thing for me, on a fresh install. TickTick API problem, it seems. @thesamim, let us know how we can help.

ms3056 commented 3 days ago

Yeah - I tried a new vault as well - I am getting the same error. It is really weird - it seems even if things on the TickTick side change, as long as you haven't disabled the plugin or messed with your login things work, even if there are some errors. But if you lose your connection and redo it, you cannot get back in.

LemurTech commented 3 days ago

@ms3056, It's because TickTickSync is caching the token behind the login. It's the retrieval of the token that's borked. TickTickSync doesn't store your username/password, just the token value.

hicaylen commented 3 days ago

Interestingly, I saw that the access token is retrieved properly but it's not properly set into data.json. This unrelated error may be preventing the login due to not storing the token.

ms3056 commented 3 days ago

@ms3056, It's because TickTickSync is caching the token behind the login. It's the retrieval of the token that's borked. TickTickSync doesn't store your username/password, just the token value.

AHA! I just thought I was going insane :) I wish I could manually get and set a token - I would be 100% OK with that.

ms3056 commented 3 days ago

Went back through my backups - copied my old data.json file from the TickTick plugin directory into the current plugin directory - all is well :) Now I know how to solve this!

I use the plugin Local Backup to backup my entire vault - it includes all plugins and snippets and themes - so your valid data,json is there :)

For me - problem solved. Thanks @LemurTech for the hint - this saved me!!!

LemurTech commented 3 days ago

@ms3056 - Are you quite sure it's syncing again? If you check the developer console, you may find that although it accepts the token, there's an issue with the API, such as this one:

plugin:tickticksync:22948 An error occurred while synchronizing: TypeError: Cannot read properties of undefined (reading 'filter')
    at SyncMan.syncTickTickToObsidian (plugin:tickticksync:22847:45)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:23487:24)
    at async HTMLDivElement.eval (plugin:tickticksync:23111:9)
ms3056 commented 3 days ago

@ms3056 - Are you quite sure it's syncing again? If you check the developer console, you may find that although it accepts the token, there's an issue with the API, such as this one:

plugin:tickticksync:22948 An error occurred while synchronizing: TypeError: Cannot read properties of undefined (reading 'filter')
    at SyncMan.syncTickTickToObsidian (plugin:tickticksync:22847:45)
    at async TickTickSync.scheduledSynchronization (plugin:tickticksync:23487:24)
    at async HTMLDivElement.eval (plugin:tickticksync:23111:9)

Tested

thesamim commented 2 days ago

@LemurTech , @hicaylen , @pplebel , @ms3056: The 503 error is indicating that TickTick's service was down. IE: The server (machine) is reachable over the network, but the service (software) that handles the requests is down.

I just saw the 503 error as I was typing this. Saw the error, Saw the exceptions. Then when I forced a Sync again, everything worked as normal. Then I tried again and got more errors. So at least able to reproduce the issue.

Working on figuring out if it's TickTickSync related or if TickTick is truly being flaky. Also working on better error messaging.

Will update ASAP.

thesamim commented 2 days ago

@LemurTech , @hicaylen , @pplebel , @ms3056: Our "Friends" at TickTick changed the way they parse headers. Again. Fixed the headers. Please let me know if there are remaining issues.

Thanks for your support!

LemurTech commented 2 days ago

You the Man, @thesamim! Thanks for staying with it, through all of TickTick's changes!

I did have trouble with the automatic update, for some reason. But I manually installed over the old files and am back in business. Thanks again!

pplebel commented 2 days ago

Thank you for the quick turnaround @thesamim, it’s really appreciated.