Todoist import not starting on fresh installation

Hey, I’ve just installed Vikunja v0.23.0 using Docker, seems like it’s working. I can create tasks and view them.

I am trying to migrate from Todoist, but the migration never starts.

Update, I figured it out, skip to the update further down.

I have set up Todoist as follows:

App name: vikunja
App service URL: https://vikunja.redacted.net
OAuth redirect URL: https://vikunja.redacted.net/migrate/todoist

I have configured Vikunja appropriately as well:

migration:
  todoist:
    # Wheter to enable the todoist migrator or not
    enable: true
    # The client id, required for making requests to the todoist api
    # You need to register your vikunja instance at https://developer.todoist.com/appconsole.html to get this
    clientid: redacted
    # The client secret, also required for making requests to the todoist api
    clientsecret: redacted
    # The url where clients are redirected after they authorized Vikunja to access their todoist items.
    # This needs to match the url you entered when registering your Vikunja instance at todoist.
    # This is usually the frontend url where the frontend then makes a request to /migration/todoist/migrate
    # with the code obtained from the todoist api.
    # Note that the vikunja frontend expects this to be /migrate/todoist
    redirecturl: https://vikunja.redacted.net/migrate/todoist

When I click the Get Started button on https://vikunja.redacted.net/migrate/todoist, I am redirected to Todoist. I click Agree and am redirected back to my Vikunja instance at https://vikunja.redacted.net/migrate/todoist?code=redacted&state=redacted. Vikunja says it will import, and will email me when done. I have confirmed that emailing works. I never get the migration email.

Looking at the logs, I see nothing relevant:

2024-02-25T18:52:00.034143269-05:00: WEB        ▶ 192.168.1.1  GET 304 /migrate/todoist 1.436126ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.323126773-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/index-9Lu9q13r.js 233.485µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.323158328-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/index-VlJ-wnF6.css 266.912µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.455415207-05:00: WEB        ▶ 192.168.1.1  GET 200 /assets/llama-nightscape-JimUD8Vz.jpg 3.566904ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.530986299-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/info 218.6µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.531044291-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/MigrationHandler-Z7R3QeEK.js 277.967µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.53104465-05:00: WEB         ▶ 192.168.1.1  GET 304 /assets/MigrationHandler-h3hkHOdg.css 227.662µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.53113043-05:00: WEB         ▶ 192.168.1.1  GET 304 /assets/migrators-pFi5a2Pm.js 320.06µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.793930173-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/user 2.477496ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.824590803-05:00: DEBUG      ▶ initials/GetAvatar 784 Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:00.824659739-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905120825 2.094467ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.956239306-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/migration/todoist/auth 189.371µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.957832101-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/notifications?page=1 1.866857ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.973936586-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/labels?page=1 17.957057ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:00.975294287-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/projects?is_archived=true&page=1 19.296728ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:01.032816123-05:00: WEB        ▶ 192.168.1.1  GET 304 /sw.js 281.143µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:05.872734593-05:00: WEB        ▶ 192.168.1.1  GET 200 /migrate/todoist?code=redacted&state=redacted 468.373µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.256074441-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/index-9Lu9q13r.js 236.93µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.256245048-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/index-VlJ-wnF6.css 309.453µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.465533695-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/migrators-pFi5a2Pm.js 232.901µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.465539219-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/MigrationHandler-Z7R3QeEK.js 246.431µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.465521073-05:00: WEB        ▶ 192.168.1.1  GET 304 /assets/MigrationHandler-h3hkHOdg.css 204.845µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.468424414-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/info 161.533µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.693467587-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/user 1.928458ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:06.693815268-05:00: WEB        ▶ 192.168.1.1  POST 200 /api/v1/user/token 2.203444ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.073578399-05:00: WEB        ▶ 192.168.1.1  GET 304 /sw.js 297.389µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.079997161-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/migration/todoist/auth 194.313µs - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.080979957-05:00: DEBUG      ▶ initials/GetAvatar 79c Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:07.081037125-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905126743 2.120372ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.081244971-05:00: DEBUG      ▶ initials/GetAvatar 79e Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:07.081288508-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905126744 1.62588ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.087915307-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/user 8.240554ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.088424337-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/notifications?page=1 8.550293ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.098997459-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/labels?page=1 19.282854ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.10131399-05:00: WEB         ▶ 192.168.1.1  GET 200 /api/v1/projects?is_archived=true&page=1 21.467162ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.135845727-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/migration/todoist/status 2.427435ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.137761095-05:00: DEBUG      ▶ initials/GetAvatar 7b6 Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:07.137819614-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905127111 1.091974ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.182928362-05:00: WEB        ▶ 192.168.1.1  POST 200 /api/v1/migration/todoist/migrate 1.062691ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:07.257111848-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/projects?is_archived=true&page=1 9.607261ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:11.50824827-05:00: WEB         ▶ 192.168.1.1  GET 200 /api/v1/notifications?page=1 2.498976ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:12.071570315-05:00: WEB        ▶ 192.168.1.1  POST 200 /api/v1/user/token 1.798737ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:12.089465768-05:00: DEBUG      ▶ initials/GetAvatar 7c7 Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:12.089534129-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905132084 1.165274ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:12.089797886-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/user 1.366078ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0
2024-02-25T18:52:12.099565611-05:00: DEBUG      ▶ initials/GetAvatar 7ca Serving initials avatar for user 1 and size 50 from cache
2024-02-25T18:52:12.099618067-05:00: WEB        ▶ 192.168.1.1  GET 200 /api/v1/avatar/jeremy?size=50&=1708905132106 1.975897ms - Mozilla/5.0 (X11; Linux x86_64; rv:123.0) Gecko/20100101 Firefox/123.0

I have tried enabling the relevant debug logging:

log:
  # A folder where all the logfiles should go.
  path: <rootpath>logs
  # Whether to show any logging at all or none
  enabled: true
  # Where the normal log should go. Possible values are stdout, stderr, file or off to disable standard logging.
  standard: "stdout"
  # Change the log level. Possible values (case-insensitive) are CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG.
  level: "DEBUG"
  # Whether or not to log database queries. Useful for debugging. Possible values are stdout, stderr, file or off to disable database logging.
  database: "off"
  # The log level for database log messages. Possible values (case-insensitive) are CRITICAL, ERROR, WARNING, NOTICE, INFO, DEBUG.
  databaselevel: "WARNING"
  # Whether to log http requests or not. Possible values are stdout, stderr, file or off to disable http logging.
  http: "stdout"
  # Echo has its own logging which usually is unnecessary, which is why it is disabled by default. Possible values are stdout, stderr, file or off to disable standard logging.
  echo: "off"
  # Whether or not to log events. Useful for debugging. Possible values are stdout, stderr, file or off to disable events logging.
  events: "stdout"
  # The log level for event log messages. Possible values (case-insensitive) are ERROR, INFO, DEBUG.
  eventslevel: "DEBUG"
  # Whether or not to log mail log messages. This will not log mail contents. Possible values are stdout, stderr, file or off to disable mail-related logging.
  mail: "off"
  # The log level for mail log messages. Possible values (case-insensitive) are ERROR, WARNING, INFO, DEBUG.
  maillevel: "INFO"

which is what I’ve pasted for my log output above.

How come I don’t see any todoist/Migrate log output, as I’ve seen elsewhere in this community while searching for solutions? It seems like it’s simply not starting.

update

Haha, as I’m writing this, I’ve figured it out. I’m going to continue, as I’ve found a bug and perhaps this will be helpful for the next user.

In short, when the migration_status table is empty, Vikunja will not start any migrations, as it thinks a migration is already running. The solution is to add a row to the migration_status table:

INSERT INTO migration_status (id, user_id, migrator_name, started_at, finished_at) VALUES (1, 1, 'todoist', '2024-02-25 19:03:10.000000', '2024-02-25 19:03:17.000000');

More info for the dev.

I saw the response from the migrate endpoint, it said “Migration already started” with a start date of 0001-01-01. I forget where in the code I saw but it seems it is defaulting to this date, rather than returning a null date.

Here is the problematic condition: vikunja/handler.go at 205f330f8a68bb4210d16d5985327a7106ddcdd7 - vikunja - Gitea

it says if StartedAt is not zero and FinishedAt is zero, assume a migration is running. However I guess that doesn’t quite work right if there are no migrations at all. Maybe it needs to check if any migration exists first. Or maybe a non-existent migration should return a null start date rather than a 0001-01-01 start date. Not sure where I saw that.

Anyway, I’m good now, but this should be helpful as a bug report and as a workaround.

Thanks!

Another bug report since I am apparently waiting for my Gitea account to be approved (signed in with github) - deleting a parent project says there are no tasks so it should be safe to delete, but it is not! I thought it would just promote child projects, but it deletes them too. disaster!

wow that’s a detailed description!

The condition you linked to is actually the solution. You’ve correctly identified the cause of the issue, but that’s already fixed. Please check with an unstable build, as that already contains the fix.

Well, if no migration exists at all, StartedAt will be zero.

That’s a general Go “problem”. If a date is zero, it is 0001-01-01 and not null. This is the case for all other dates as well.

I went ahead and approved your account.