TomFrankly / pipedream-notion-recurring-tasks

4 stars 2 forks source link

Bug: Cannot read properties of undefined (reading 'iso8601') #14

Closed Xytronix closed 6 months ago

Xytronix commented 6 months ago

I do get the following error while setting up the properties prior to testing

Cannot read properties of undefined (reading 'iso8601')

at Object.run (file:///tmp/__pdg__/dist/code/f1a18e75fe918398e71565d5f747a71993c0ac9a8d42a15bedf84624bc136ffd/component.mjs:937:49)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at null.executeComponent (/var/task/launch_worker.js:288:22)
    at MessagePort.messageHandler (/var/task/launch_worker.js:788:28)
TomFrankly commented 6 months ago

Hi @Xytronix ,

Did you test your Trigger step? If you did, that iso8601 object should exist. This error message indicates that it doesn't, which should only happen if the trigger step wasn't tested.

CleanShot 2024-05-13 at 09 56 23@2x

Xytronix commented 6 months ago

Yep, I tested the trigger step and the error went away.

However, I experienced a different problem. All tasks went unchecked, despite not recurring, and the Type formula property was replaced with the following each run:

if(empty(prop("Recur Interval")), "⏳One-Time", "⏳One-Time")

Even though this was initially set up:

!prop("Recur Interval")
    ? "⏳One-Time"
    : "🔄Recurring"
TomFrankly commented 6 months ago

@Xytronix the Type property should indeed be replaced with that top formula. It's confusing for sure, but it needs to happen – that bottom version of Type is only useful for people who are doing the "manual" version of recurring task processing. It simply keeps tasks from leaving task views if "Done" is checked.

But when we do automated processing with this script, you want those tasks to leave until they're unchecked again.

As for all taks going unchecked – that shouldn't happen. You can see in the code that this script will only pull tasks where the Next Due API property is not the "∅" symbol: https://github.com/TomFrankly/pipedream-notion-recurring-tasks/blob/main/notion-recurring-tasks.mjs#L673C30-L673C30

And by default, tasks without a Recur Interval will have that symbol. If they don't, then there may be something wrong with your properties. If you're not using one of my up-to-date templates, you can find the correct formulas in the first toggle here: https://thomasjfrank.com/notion-automated-recurring-tasks/#faqs-and-reference-guides

Xytronix commented 6 months ago

I got to the root of the problem. When a due date is set for a non-recurring task, pipedream will update it. Whether it's from the past or in the future. Such a scenario wasn't considered for the Next Due API property.

I have tasks set for a due date of 12 January 2024, pipedream will make them recurrent each run, although nothing else was set up.

TomFrankly commented 6 months ago

@Xytronix can you share a screen recording at all? That shouldn't happen, and has never happened for me, and I have plenty of non-recurring tasks with due dates. I've never seen this reported by any other user, either.

The Pipedream automation only queries your Notion database for finished recurring tasks. The query filter in the code looks both for a "Done" status, as well as for a Next Due API value that isn't "∅". And any task that doesn't have a Recur Interval set should have "∅" as its Next Due API value.

For example, this task in my tasks database has a due date, but no recur interval:

CleanShot 2024-05-14 at 09 35 36@2x

As a result, the Next Due API value is "∅", and thus it doesn't get processed by Pipedream.

CleanShot 2024-05-14 at 09 36 13@2x

Xytronix commented 6 months ago

Issue resolved, there was an issue with wrong linked property names. Sorry for the inconvenience.