thesamim / TickTickSync

GNU General Public License v3.0
133 stars 8 forks source link

Checkpoint Fetch failing #125

Closed blakebenton closed 5 months ago

blakebenton commented 5 months ago

Initial authentication with the plugin to TickTick account fails. Error popup is "Login Failed.undefined"

Steps to reproduce the behavior:

  1. Go to plugin settings
  2. Enter TickTick Username and Password
  3. Click the Login button.
  4. Get following error: image

After pulling up the developer console I can see that I actually do get signed in, and get a token. I get a series of "Check point has been changed." messages and then it bails out. image

Environment

viviengarcia commented 5 months ago

Same here (issue, os, versions) 😅

thesamim commented 5 months ago

Looks like TickTick has made another change... Will investigate ASAP.

thesamim commented 5 months ago

Please try with 1.0.28

thesamim commented 5 months ago

Ok, this at least fetches the tasks. But I'm not convinced everything is back to normal. Will test some more tomorrow.

viviengarcia commented 5 months ago

Still get the error with v1.0.28

thesamim commented 5 months ago

Could you paste your console log please? 

Suyashtnt commented 5 months ago

image

I have the same issue still. Heres my logs

viviengarcia commented 5 months ago

Not sure if this is what's asked. EDIT: resized for thread readability.

thesamim commented 5 months ago

Thanks. Working on it now.

thesamim commented 5 months ago

Please try again with release 1.0.29.

If you still encounter issues:

  1. make sure Debug Mode is turned on
  2. right-click in the console log and choose "Save As"
  3. Send me the whole log please.

What's going on: When fetching tasks from TickTick, one of the parameters is a "checkpoint". What I have learned through experimentation is that "checkpoint" is actually an epoch time from the last fetch. So, theoretically Ticktick is only returning changes since the last checkpoint. When I first wrote the plugin, Ticktick accepted 0 as a valid checkpoint, and returned all tasks. Then it didn't Then -1 returned returned all tasks. Then it didn't. (Full disclosure: running from postman, it still did. But not from the plugin. I haven't quite figured that one out.) So now I'm attempting to set the starting checkpoint as 2013-01-01T00:00:00.000+0000, which is the year that TickTick started. This has worked on my vault. I'm hoping it works for all vaults.

In the fullness of time, I want to update the fetch logic in TickTickSync to take advantage of this "feature" and reduce the network traffic. As in: Determine an arbitrary starting point for fetching (eg: 2013-01-01T00:00:00.000+0000), then keep track of the last fetch date and process task changes accordingly. I'm sure there will be some unwanted side-effects so I want to thoroughly test the theory before releasing it.

Suyashtnt commented 5 months ago

Please try again with release 1.0.29.

If you still encounter issues:

1. make sure Debug Mode is turned on

2. right-click in the console log and choose "Save As"

3. Send me the whole log please.

What's going on: When fetching tasks from TickTick, one of the parameters is a "checkpoint". What I have learned through experimentation is that "checkpoint" is actually an epoch time from the last fetch. So, theoretically Ticktick is only returning changes since the last checkpoint. When I first wrote the plugin, Ticktick accepted 0 as a valid checkpoint, and returned all tasks. Then it didn't Then -1 returned returned all tasks. Then it didn't. (Full disclosure: running from postman, it still did. But not from the plugin. I haven't quite figured that one out.) So now I'm attempting to set the starting checkpoint as 2013-01-01T00:00:00.000+0000, which is the year that TickTick started. This has worked on my vault. I'm hoping it works for all vaults.

In the fullness of time, I want to update the fetch logic in TickTickSync to take advantage of this "feature" and reduce the network traffic. As in: Determine an arbitrary starting point for fetching (eg: 2013-01-01T00:00:00.000+0000), then keep track of the last fetch date and process task changes accordingly. I'm sure there will be some unwanted side-effects so I want to thoroughly test the theory before releasing it.

log.log looks like it still aint working

thesamim commented 5 months ago

looks like it still aint working

Need more info, please:

  1. Close all instances of Obsidian
  2. Reopen the one vault with TickTickSyn enabled
  3. Login from settings
  4. Do a Sync
  5. Send logs again please.

Please do NOT do a "Check Database.", it's just adding unnecessary logging at this point.

Thanks

viviengarcia commented 5 months ago

Doesn't work for me neither. TickTickSync 1.0.29, applied the instructions above, can't even login: Login Failed.undefined. (EDIT: formating for readability)

Console Log ```LogTalk 23:40:22.724 plugin:tickticksync:12250 Starting Checkpoint date: Tue Jan 01 2013 01:00:00 GMT+0100 (Central European Standard Time) Checkpoint 1356998400000 23:40:23.261 plugin:tickticksync:12270 Signed in Response: Object 23:40:23.494 plugin:tickticksync:12748 Date: Mon Dec 17 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.495 plugin:tickticksync:12750 Date: Mon Dec 17 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.495 plugin:tickticksync:12751 Attempted Checkpoint: 1355702400000 23:40:23.495 plugin:tickticksync:12753 Check point has been changed. 1355702400000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:23.677 plugin:tickticksync:12748 Date: Sun Dec 02 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.678 plugin:tickticksync:12750 Date: Sun Dec 02 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.678 plugin:tickticksync:12751 Attempted Checkpoint: 1354406400000 23:40:23.678 plugin:tickticksync:12753 Check point has been changed. 1354406400000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:23.855 plugin:tickticksync:12748 Date: Sat Nov 17 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.855 plugin:tickticksync:12750 Date: Sat Nov 17 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:23.855 plugin:tickticksync:12751 Attempted Checkpoint: 1353110400000 23:40:23.855 plugin:tickticksync:12753 Check point has been changed. 1353110400000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:24.050 plugin:tickticksync:12748 Date: Fri Nov 02 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:24.050 plugin:tickticksync:12750 Date: Fri Nov 02 2012 01:00:00 GMT+0100 (Central European Standard Time) 23:40:24.051 plugin:tickticksync:12751 Attempted Checkpoint: 1351814400000 23:40:24.051 plugin:tickticksync:12753 Check point has been changed. 1351814400000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:24.230 plugin:tickticksync:12748 Date: Thu Oct 18 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.230 plugin:tickticksync:12750 Date: Thu Oct 18 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.230 plugin:tickticksync:12751 Attempted Checkpoint: 1350514800000 23:40:24.231 plugin:tickticksync:12753 Check point has been changed. 1350514800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:24.408 plugin:tickticksync:12748 Date: Wed Oct 03 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.408 plugin:tickticksync:12750 Date: Wed Oct 03 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.409 plugin:tickticksync:12751 Attempted Checkpoint: 1349218800000 23:40:24.409 plugin:tickticksync:12753 Check point has been changed. 1349218800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:24.600 plugin:tickticksync:12748 Date: Tue Sep 18 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.601 plugin:tickticksync:12750 Date: Tue Sep 18 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.601 plugin:tickticksync:12751 Attempted Checkpoint: 1347922800000 23:40:24.601 plugin:tickticksync:12753 Check point has been changed. 1347922800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:24.782 plugin:tickticksync:12748 Date: Mon Sep 03 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.783 plugin:tickticksync:12750 Date: Mon Sep 03 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:24.783 plugin:tickticksync:12751 Attempted Checkpoint: 1346626800000 23:40:24.783 plugin:tickticksync:12753 Check point has been changed. 1346626800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:25.000 plugin:tickticksync:12748 Date: Sun Aug 19 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:25.001 plugin:tickticksync:12750 Date: Sun Aug 19 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:25.001 plugin:tickticksync:12751 Attempted Checkpoint: 1345330800000 23:40:25.001 plugin:tickticksync:12753 Check point has been changed. 1345330800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 23:40:25.203 plugin:tickticksync:12748 Date: Sat Aug 04 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:25.204 plugin:tickticksync:12750 Date: Sat Aug 04 2012 01:00:00 GMT+0200 (Central European Summer Time) 23:40:25.204 plugin:tickticksync:12751 Attempted Checkpoint: 1344034800000 23:40:25.204 plugin:tickticksync:12753 Check point has been changed. 1344034800000 getNextCheckPoint @ plugin:tickticksync:12753 getInboxProperties @ plugin:tickticksync:12305 ```
thesamim commented 5 months ago

@viviengarcia : could you please show me the log after you click on Sync?

Edit: when you saw: Login Failed.undefined, the log, there will be a corresponding error log. If you could send me the stack trace associated with that error message (by expanding it) that would be helpful too.

Suyashtnt commented 5 months ago

looks like it still aint working

Need more info, please:

1. Close all instances of Obsidian

2. Reopen the one vault with TickTickSyn enabled

3. Login from settings

4. Do a Sync

5. Send logs again please.

Please do NOT do a "Check Database.", it's just adding unnecessary logging at this point.

Thanks

Uh it seems to have all of a sudden started working on my laptop, Weird. Logs seem good now as well

viviengarcia commented 5 months ago

@thesamim I don't have the Sync button, since the login fails

thesamim commented 5 months ago

@thesamim I don't have the Sync button, since the login fails

If you turn on debug mode, you will see a sync button in your icons bar. You may have to close obsidian and open it again.

Also if you close settings and open it again.

Q: when's the last time you had a successful login.

thesamim commented 5 months ago

Uh it seems to have all of a sudden started working on my laptop, Weird. Logs seem good now as well

Mixed blessings: on the one hand, great it's working!

On the other hand, but we still don't know what the differences between your set up and mine (that resulted in stuff working for me but not for you) were.

As a software engineer: "it suddenly started working again" is just as scary as "it suddenly stopped working." It means the problem is going to come back at some point.

Of course, part of this is that we are the mercy of ticktick and the undocumented API. But that's a different discussion.

thesamim commented 5 months ago

@viviengarcia, @blakebenton , @Suyashtnt : I'm leaving this issue open until I'm convinced that we're back to steady state.

viviengarcia commented 5 months ago

I already had debug mode turned on (at least in tickticksync). I tried turning both obsidian and your plugin off and on again but no sync button. Also I just started with ticktick so I never could login from tickticksync (no issue using ticktick app or web though)

25 Apr 2024 16:28:23 thesamim @.***>:

@thesamim[https://github.com/thesamim] I don't have the Sync button, since the login fails

If you turn on debug mode, you will see a sync button in your icons bar. You may have to close obsidian and open it again.

Also if you close settings and open it again.

Q: when's the last time you had a successful login.

— Reply to this email directly, view it on GitHub[https://github.com/thesamim/TickTickSync/issues/125#issuecomment-2077342804], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAN5YRSZUELXNCGCKIC47Q3Y7EHIPAVCNFSM6AAAAABGU7ODG2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANZXGM2DEOBQGQ]. You are receiving this because you were mentioned. [Tracking image][https://github.com/notifications/beacon/AAN5YRW2GDMSTMYX4R4CPADY7EHIPA5CNFSM6AAAAABGU7ODG2WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTT32G6FI.gif]

thesamim commented 5 months ago

I already had debug mode turned on (at least in tickticksync). I tried turning both obsidian and your plugin off and on again but no sync button. image Highlighted is the Sync Button. If you don't see that, we're dealing with a different issue altogether.

Also I just started with ticktick so I never could login from tickticksync (no issue using ticktick app or web though)

Ok, that's a different issue.

Let's work on that first.

When you login to TickTick, on the Web or on the App, are you using an email and password combination or are you using Google/Apple/Facebook? If you are using one of those authenticators, are you able to sign in with email/password only?

If you can send me the console log from your attempt to login, I will try to figure out what's going on.

blakebenton commented 5 months ago

I'm still seeing the same issue. I never get logged in, when I hit the sync button on the toolbar it does nothing because it never was logged in, no messages in console or anything.

thesamim commented 5 months ago

I'm still seeing the same issue. I never get logged in, when I hit the sync button on the toolbar it does nothing because it never was logged in, no messages in console or anything.

Questions:

  1. Have you ever been able to login with TickTickSync?
  2. When you login to TickTick, on the Web or on the App, are you using an email and password combination or are you using Google/Apple/Facebook? If you are using one of those authenticators, are you able to sign in with email/password only?
  3. Do you have Debug Mode turned on in the settings?
blakebenton commented 5 months ago

Thank you for your response.

  1. No I've never logged in, first time I've attempted to use TickTickSync
  2. I'm logging in with email/password combo, NOT using Google/Apple/Facebook.
  3. I have Debug Mode turned on in the TickTickSync settings.
viviengarcia commented 5 months ago

Highlighted is the Sync Button. If you don't see that, we're dealing with a different issue altogether.

Thanks I missed that.

When you login to TickTick, on the Web or on the App, are you using an email and password combination or are you using Google/Apple/Facebook? If you are using one of those authenticators, are you able to sign in with email/password only?

I'm using email & password combination from the start to login in the app and on the web.

If you can send me the console log from your attempt to login, I will try to figure out what's going on.

There. Edited personal info (user id, user code, email). What I did :

  1. Cleared console log
  2. Deactivated TickTickSync
  3. Restarted obsidian
  4. Activated TicktickSync
  5. Initiated login from settings
  6. "Login Failed.undefined"

  7. Clicked on the sync button
  8. "Please login from the settings"

  9. "Sync completed" (no)

  10. Opened console and exported the log

obsidian.md-1714090845735.log

thesamim commented 5 months ago

@viviengarcia , @blakebenton : The datapoint I was missing was this was the first time y'all were loging in. This in addition to a change on the TickTick side was the root cause.

Please try again with 1.0.30

Thanks for your patience.

viviengarcia commented 5 months ago

Thanks a lot @thesamim, I tried earlier on my phone and it worked! … Unfortunately I got this message on desktop app (the main device I tried to make TickTickSync work):

I did a bit of research to see if I could follow some instructions to resolve the issue by myself, with no success so far.

EDIT: I went on TickTick Web and tried to remove connected device, thinking perhaps there was a confusion between "too many attempts" and "too many devices", but it didn't work. Also, most of the devices connected were identified as Firefox on Windows 10, which I find very weird. I don't have windows 10, and obsidian is based on chromium AFAIK. So my question is how is this possible?

thesamim commented 5 months ago

@viviengarcia : Glad it's at least working on the phone.

that's the error ticktick spits back when you get the email or password wrong. But sometimes it throws that up when it's confused. If you are able to login with that userid and password on the web, but not on the application, chances are I'm still missing something in the code.

Question: Are you sure you are on 1.0.30 on your desktop? I fixed this image to give an actual error message in 1.0.30.

viviengarcia commented 5 months ago

Yes, the Login Failed.undefined was probably from before I updated the plugin. I restarted obsidian to be sure, tried to login and got this:

Here is the log: obsidian.md-1714164905651.log

thesamim commented 5 months ago

Yes, the Login Failed.undefined was probably from before I updated the plugin. I restarted obsidian to be sure, [...]

Great.

When you log in from the Web right now, are you able to login?

If you are not: you will probably need to either wait 24 hours or ask ticktick for a reset via their support email.

This: 22:50:30.560 plugin:tickticksync:12777 {"baseUrl":"ticktick.com","token":"[0CAB80045A...] len: 368"} tells me you had at least one successful login at some point from TickTickSync

Question: Are you using the same vault on both your desktop and your phone? If so: are you using the same userid and password on both?

viviengarcia commented 5 months ago

When you log in from the Web right now, are you able to login?

Yes

If you are not: you will probably need to either wait 24 hours or ask ticktick for a reset via their support email.

Noted, I'll stop login on desktop for now and try in 24H

This: 22:50:30.560 plugin:tickticksync:12777 {"baseUrl":"ticktick.com","token":"[0CAB80045A...] len: 368"} tells me you had at least one successful login at some point from TickTickSync

You mean on desktop?

Question: Are you using the same vault on both your desktop and your phone? If so: are you using the same userid and password on both?

Yes, same vault and same userid/pswd on every device (obsidian, vault, ticktick)

thesamim commented 5 months ago

When you log in from the Web right now, are you able to login?>

Yes

That tells me there's an issue with the way the login is being processed from the desktop.

You mean on desktop?

Now that I know you are using the same vault on both dekstop and phone, it may be a result of the successful login on the phone.

How are you synchronizing between desktop and phone?

Out of curiosity: What happens if you just try clicking on "Sync"?

The next troubleshooting steps are:

  1. uninstall TickTickSync on desktop
  2. disable all other plugins on dekstop (for now)
  3. re-install TickTickSyn on desktop
  4. Try to login
  5. If it works: re-enable other plugins and try clicking on "Sync". Let met know what happens. Then we enable other plugins one by one and see if any of them interfere....
  6. If it doesn't work: Could you please send me your data.json file from the TickTickSync plugin directory. (Please edit any sensitive information in data.json....)
viviengarcia commented 5 months ago

I tried to login from the desktop this morning. It worked and consequently after activating on my mobile it worked too. For now I'd say this issue is resolved. But now I've found other issues I'll open a bit later. It's mostly tasks duplicates and task (when created from TickTick) that are created on a specific day note, no matter what setting I try. As I said, I'll post a correct issue later.

Anyway thanks for the help and reactivity @thesamim!

blakebenton commented 5 months ago

Working for me now! Thank you!

thesamim commented 5 months ago

@viviengarcia @blakebenton @Suyashtnt : Thank you for your help.