moranje / alfred-workflow-todoist

An Alfred workflow for managing tasks in Todoist
MIT License
328 stars 48 forks source link

Hidden API errors #124

Open stacksjb opened 5 years ago

stacksjb commented 5 years ago

Description

I recently found that despite me creating multiple todos, they weren't being created. After deeper troubleshooting, I've found a very weird issue. It appears that I can only create a single task at a time - creating a second one fails with an error code 400. However, if I mark a task as complete, then creation of a second task succeeds.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a task, i.e. Alfred input 'todo TEST' -Task creates successfully
  2. Create a second task, i.e. Alfred input 'todo TEST1" -Task fails to create
  3. Query and mark a task complete ('todos TEST') -Task marked as completed
  4. Attempt to create second task again, i.e. Alfred input 'todo TEST1' -Task creates successfully

Expected behavior

Tasks should create successfully every time, regardless of how many times task creation is run.

Error logs

STEPS:

  1. Open workflows tab in Alfred
  2. Select Alfred Workflow Todoist
  3. Select Toggle debugging mode in de upper right corner
  4. Set logging to All information 5. Rerun query

Log:

[10:35:44.659] Alfred Workflow Todoist[Script Filter] Queuing argument 'T'
[10:35:44.783] Alfred Workflow Todoist[Script Filter] Queuing argument 'TE'
[10:35:44.901] Alfred Workflow Todoist[Script Filter] Queuing argument 'TES'
[10:35:45.036] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST'
[10:35:45.069] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:35:45.080] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: T","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"T\",\"priority\":1}","type":"default","valid":true}]}
[10:35:45.456] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:35:45.464] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST\",\"priority\":1}","type":"default","valid":true}]}
[10:35:45.882] Alfred Workflow Todoist[Script Filter] Processing complete
[10:35:45.897] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"TEST","priority":1}' to Run Script
[10:35:46.855] Alfred Workflow Todoist[Run Script] Processing complete
[10:35:46.865] Alfred Workflow Todoist[Run Script] Passing output 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task added

' to Debug
[10:35:46.866] Alfred Workflow Todoist[Debug] 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task added

', {}
[10:35:46.867] Alfred Workflow Todoist[Debug] Processing complete

[10:35:48.776] Alfred Workflow Todoist[Script Filter] Queuing argument 'T'
[10:35:49.068] Alfred Workflow Todoist[Script Filter] Queuing argument 'TE'
[10:35:49.184] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:35:49.194] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: T","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"T\",\"priority\":1}","type":"default","valid":true}]}
[10:35:49.216] Alfred Workflow Todoist[Script Filter] Queuing argument 'TES'
[10:35:49.425] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST'
[10:35:49.583] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:35:49.593] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TE","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TE\",\"priority\":1}","type":"default","valid":true}]}
[10:35:49.760] Alfred Workflow Todoist[Script Filter] Processing complete
[10:35:49.774] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"TE","priority":1}' to Run Script
[10:35:50.419] Alfred Workflow Todoist[Run Script] Processing complete
[10:35:50.428] Alfred Workflow Todoist[Run Script] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TE","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Debug
[10:35:50.430] Alfred Workflow Todoist[Debug] 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TE","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
', {}
[10:35:50.434] Alfred Workflow Todoist[Debug] Processing complete
[10:35:50.435] Alfred Workflow Todoist[Debug] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TE","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Post Notification
[10:39:49.773] Alfred Workflow Todoist[Script Filter] Queuing argument 'T'
[10:39:49.903] Alfred Workflow Todoist[Script Filter] Queuing argument 'TE'
[10:39:50.015] Alfred Workflow Todoist[Script Filter] Queuing argument 'TES'
[10:39:50.125] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST'
[10:39:50.225] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST '
[10:39:50.396] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:39:50.410] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: T","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"T\",\"priority\":1}","type":"default","valid":true}]}
[10:39:50.427] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST T'
[10:39:50.625] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST '
[10:39:50.789] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:39:50.794] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST\",\"priority\":1}","type":"default","valid":true}]}
[10:39:50.997] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST T'
[10:39:51.157] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST TA'
[10:39:51.170] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:39:51.177] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST\",\"priority\":1}","type":"default","valid":true}]}
[10:39:51.327] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST TAS'
[10:39:51.425] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST TASK'
[10:39:51.592] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:39:51.600] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST TA","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST TA\",\"priority\":1}","type":"default","valid":true}]}
[10:39:51.983] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:39:51.991] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST TASK","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST TASK\",\"priority\":1}","type":"default","valid":true}]}
[10:39:52.468] Alfred Workflow Todoist[Script Filter] Processing complete
[10:39:52.483] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"TEST TASK","priority":1}' to Run Script
[10:39:53.141] Alfred Workflow Todoist[Run Script] Processing complete
[10:39:53.149] Alfred Workflow Todoist[Run Script] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TEST TASK","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Debug
[10:39:53.150] Alfred Workflow Todoist[Debug] 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TEST TASK","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
', {}
[10:39:53.153] Alfred Workflow Todoist[Debug] Processing complete
[10:39:53.154] Alfred Workflow Todoist[Debug] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TEST TASK","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Post Notification
[10:40:10.152] Alfred Workflow Todoist[Script Filter] Queuing argument 't'
[10:40:10.416] Alfred Workflow Todoist[Script Filter] Queuing argument 'te'
[10:40:10.561] Alfred Workflow Todoist[Script Filter] Queuing argument 'tes'
[10:40:10.580] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:10.593] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: t","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"t\",\"priority\":1}","type":"default","valid":true}]}
[10:40:10.721] Alfred Workflow Todoist[Script Filter] Queuing argument 'test'
[10:40:10.856] Alfred Workflow Todoist[Script Filter] Queuing argument 'test '
[10:40:10.992] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:11.006] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: tes","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"tes\",\"priority\":1}","type":"default","valid":true}]}
[10:40:11.023] Alfred Workflow Todoist[Script Filter] Queuing argument 'test t'
[10:40:11.144] Alfred Workflow Todoist[Script Filter] Queuing argument 'test ta'
[10:40:11.211] Alfred Workflow Todoist[Script Filter] Queuing argument 'test tas'
[10:40:11.352] Alfred Workflow Todoist[Script Filter] Queuing argument 'test task'
[10:40:11.402] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:11.418] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: test","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"test\",\"priority\":1}","type":"default","valid":true}]}
[10:40:11.788] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:11.793] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: test task","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"test task\",\"priority\":1}","type":"default","valid":true}]}
[10:40:12.953] Alfred Workflow Todoist[Script Filter] Processing complete
[10:40:12.963] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"test task","priority":1}' to Run Script
[10:40:13.604] Alfred Workflow Todoist[Run Script] Processing complete
[10:40:13.613] Alfred Workflow Todoist[Run Script] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"test task","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Debug
[10:40:13.615] Alfred Workflow Todoist[Debug] 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"test task","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
', {}
[10:40:16.429] Alfred Workflow Todoist[Script Filter] Queuing argument ''
[10:40:16.829] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:16.838] Alfred Workflow Todoist[Script Filter] 
--snip--
{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"COMPLETE: TEST","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"id\":3518077794,\"project_id\":2003953961,\"order\":321,\"content\":\"TEST\",\"completed\":false,\"label_ids\":[],\"priority\":1,\"comment_count\":0,\"created\":\"2019-11-19T17:35:46Z\"}","type":"default","valid":true}]}
[10:40:17.968] Alfred Workflow Todoist[Script Filter] Processing complete
[10:40:17.975] Alfred Workflow Todoist[Script Filter] Passing output '{"id":3518077794,"project_id":2003953961,"order":321,"content":"TEST","completed":false,"label_ids":[],"priority":1,"comment_count":0,"created":"2019-11-19T17:35:46Z"}' to Run Script
[10:40:18.702] Alfred Workflow Todoist[Run Script] Processing complete
[10:40:18.708] Alfred Workflow Todoist[Run Script] Passing output 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task completed

' to Debug
[10:40:18.710] Alfred Workflow Todoist[Debug] 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task completed

', {}
[10:40:20.009] Alfred Workflow Todoist[Script Filter] Queuing argument 't'
[10:40:20.100] Alfred Workflow Todoist[Script Filter] Queuing argument 'te'
[10:40:20.193] Alfred Workflow Todoist[Script Filter] Queuing argument 'tes'
[10:40:20.282] Alfred Workflow Todoist[Script Filter] Queuing argument 'test'
[10:40:20.376] Alfred Workflow Todoist[Script Filter] Queuing argument 'test '
[10:40:20.445] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:20.451] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: t","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"t\",\"priority\":1}","type":"default","valid":true}]}
[10:40:20.481] Alfred Workflow Todoist[Script Filter] Queuing argument 'test t'
[10:40:20.562] Alfred Workflow Todoist[Script Filter] Queuing argument 'test ta'
[10:40:20.634] Alfred Workflow Todoist[Script Filter] Queuing argument 'test tas'
[10:40:20.722] Alfred Workflow Todoist[Script Filter] Queuing argument 'test task'
[10:40:20.859] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:20.870] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: test","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"test\",\"priority\":1}","type":"default","valid":true}]}
[10:40:20.907] Alfred Workflow Todoist[Script Filter] Processing complete
[10:40:20.909] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"test","priority":1}' to Run Script
[10:40:21.828] Alfred Workflow Todoist[Run Script] Processing complete
[10:40:21.838] Alfred Workflow Todoist[Run Script] Passing output 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task added

' to Debug
[10:40:21.840] Alfred Workflow Todoist[Debug] 'ALFRED WORKFLOW TODOIST: ✓ Happy days!

Task added

', {}
[10:40:31.613] Alfred Workflow Todoist[Script Filter] Queuing argument 't'
[10:40:31.764] Alfred Workflow Todoist[Script Filter] Queuing argument 'te'
[10:40:31.948] Alfred Workflow Todoist[Script Filter] Queuing argument 'tes'
[10:40:32.034] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:32.045] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: t","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"t\",\"priority\":1}","type":"default","valid":true}]}
[10:40:32.046] Alfred Workflow Todoist[Script Filter] Queuing argument 'test'
[10:40:32.140] Alfred Workflow Todoist[Script Filter] Queuing argument 'test '
[10:40:32.244] Alfred Workflow Todoist[Script Filter] Queuing argument 'test t'
[10:40:32.342] Alfred Workflow Todoist[Script Filter] Queuing argument 'test ta'
[10:40:32.412] Alfred Workflow Todoist[Script Filter] Queuing argument 'test tas'
[10:40:32.454] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:32.470] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: tes","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"tes\",\"priority\":1}","type":"default","valid":true}]}
[10:40:32.518] Alfred Workflow Todoist[Script Filter] Queuing argument 'test task'
[10:40:32.863] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:32.878] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: test tas","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"test tas\",\"priority\":1}","type":"default","valid":true}]}
[10:40:33.249] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:33.261] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: test task","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"test task\",\"priority\":1}","type":"default","valid":true}]}
[10:40:34.677] Alfred Workflow Todoist[Script Filter] Queuing argument 'T'
[10:40:34.796] Alfred Workflow Todoist[Script Filter] Queuing argument 'TE'
[10:40:34.941] Alfred Workflow Todoist[Script Filter] Queuing argument 'TES'
[10:40:35.030] Alfred Workflow Todoist[Script Filter] Queuing argument 'TEST'
[10:40:35.092] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:35.107] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: T","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"T\",\"priority\":1}","type":"default","valid":true}]}
[10:40:35.475] Alfred Workflow Todoist[Script Filter] Script with argv '(null)' finished
[10:40:35.480] Alfred Workflow Todoist[Script Filter] {"items":[{"uid":"693e9af84d3dfcc71e640e005bdc5e2e","title":"CREATE: TEST","subtitle":"INBOX","icon":{"path":"icon.png"},"arg":"{\"content\":\"TEST\",\"priority\":1}","type":"default","valid":true}]}
[10:40:37.049] Alfred Workflow Todoist[Script Filter] Processing complete
[10:40:37.056] Alfred Workflow Todoist[Script Filter] Passing output '{"content":"TEST","priority":1}' to Run Script
[10:40:37.708] Alfred Workflow Todoist[Run Script] Processing complete
[10:40:37.719] Alfred Workflow Todoist[Run Script] Passing output 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TEST","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
' to Debug
[10:40:37.721] Alfred Workflow Todoist[Debug] 'HTTPError: Response code 400 (Bad Request)

ALFRED WORKFLOW TODOIST
----------------------------------------
os: macOS 10.15.0
query: {"content":"TEST","priority":1}
node.js: v12.13.1
alfred: unknown
workflow: 5.8.3
Stack: HTTPError: Response code 400 (Bad Request)
    at EventEmitter.<anonymous> (/Users/jesse.stanford/Dropbox/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.EEB9661C-EE43-4BC7-9415-5A6B3C55C196/alfred-workflow-todoist.js:34222:19)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
', {}

 ...

Additional context

Is there perhaps some local file that is getting locked or could be causing this issue? I find it quite odd.

ADDITIONAL SUGGESTIONS:

1) Please add a notification for task creation/failed successfully to the end of the workflow. I thought I was creating several tasks but they were not created, which is very frustrating, as I use the Todoist via Alfred as my Inbox (in GTD) to dump tasks to be created for organization later.

stacksjb commented 5 years ago

Is there a debug module I can enable beyond the Alfred debug? I suspect there is something on the node side going on.

stacksjb commented 5 years ago

I have identified the root cause of the issue: Todoist has a hardcoded limit of 300 tasks in a project. I hit the limit, so all new task creation was failing. Marking a task complete takes it down to 299, then the next complete, but thereafter fails. (NOTE: This is for Premium/Business subscribers; free I believe have a limit of 150)

Could you return a more useful error message instead of just failing with an error code 400? In addition I still an unsure why notifications are not working - I downloaded an older version to test (4.x) and found that notifications worked successfully on those versions (though obviously task creation failed due to the older API). In addition, I tested running the 'terminal notifier' manually from shell and successfully received an alert notification.

I have worked around this issue in the meantime by adding a "post notification" within Alfred using the "Post notification" option, which at least returns "ALFRED WORKFLOW TODOIST: ✓ Happy days!" or the "Error 400".

moranje commented 5 years ago

Hmmm I'd have to see. I return what I get from todoist API. It's a little bit of an edge case where I would need to create a somewhere around 280 dummy tasks to test this. Any chance you could try what the API returns in your case? It is fairly easy with the rest API and something like postman. Would you be up for that?

The notifications I'm not entirely sure but it's probably easier to create a separate issue to track this, wouldn't you agree?

stacksjb commented 5 years ago

I tested creation using the documented API with CURL (https://developer.todoist.com/rest/v8/?shell#get-active-tasks) and receive the response "Maximum number of items per user project limit reached" as a response once I hit 300.

curl "https://api.todoist.com/rest/v1/tasks" \ -X POST \ --data '{"content": "Appointment with Maria", "due_string": "tomorrow at 12:00", "due_lang": "en", "priority": 4}' \ -H "Content-Type: application/json" \ -H "X-Request-Id: $(uuidgen)" \ -H "Authorization: Bearer <apikey>" Maximum number of items per user project limit reached

I'll clone for the notifications issue.

moranje commented 5 years ago

Thanks that helps. I'll see what I can do.

moranje commented 4 years ago

Should be fixed in the v6.0.0-alpha.3. It should be stable enough to use as your daily driver, I now have tests for 80% of the code base.

If you want to keep receiving updates set todo:setting pre_releases true. I still need to update the docs so not all the changes are documented yet.

Martien