Error with Notion recurring workflow, adapted from Tilde labs

Hi I have adapted a workflow from Tilde Labs to handle recurring tasks for many months in Notion.

I have noticed for a few days now, it has stopped working with the following error. did anyone have the same error and knows what is wrong?

Update recurring tasks with new dates...
{
  object: 'error',
  status: 400,
  code: 'validation_error',
  message: 'Unsaved transactions: Unrecognized error.'
}

steps.updateRecurringTasks.updatedTasks[0]

Hi @elizabethtan79,

I’m sorry to hear that you’re experiencing issues with your workflow. The error message you provided indicates a validation error from the Notion API. To help you further, I’ll need more information about the specific step in your workflow that’s causing the issue and the code you’re using.

If you’re using a Pipedream component to update the recurring tasks in Notion, please let me know which component you’re using and any relevant details about the input data.

If you’re using custom code to update the tasks, please share the relevant code snippet, so I can better understand the issue and help you resolve it.

If you continue to experience issues or need further assistance, you can also visit https://pipedream.com/support for more support options.
I’m a bot powered by Pipedream and GPT-4. I’m still learning, so please double check my answers and code! Learn how to build your own.

const axios = require(“axios”)
const moment = require(“moment”)
const DATE_TIME_REGEX = /^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{3})?(-[0-9]{2}:[0-9]{2})?$/
this.updatedTasks = []

// Update tasks
console.log(“Update recurring tasks with new dates…”)
for (const task of steps.fetchCompletedRecurringTasks.tasks) {
let patch = { properties : {} }
// Uncheck the Complete checkbox
patch.properties[steps.config.PROPS.complete] = { checkbox: false }

// Modify the due date
patch.properties[steps.config.PROPS.dueDate] = { date : {} }
// Modify the start date
let startDate = task.properties[steps.config.PROPS.dueDate].date.start ? moment.parseZone(task.properties[steps.config.PROPS.dueDate].date.start) : null
if (!(task.properties[steps.config.PROPS.interval].select.name in steps.config.INTERVALS)) continue
startDate.add(…steps.config.INTERVALS[task.properties[steps.config.PROPS.interval].select.name])
let startDateFormat = DATE_TIME_REGEX.test(task.properties[steps.config.PROPS.dueDate].date.start) ? “YYYY-MM-DDTHH:mm:ss.SSSZ” : “YYYY-MM-DD” // Date only or Date & Time
patch.properties[steps.config.PROPS.dueDate].date.start = startDate.format(startDateFormat)

// Modify the end date, if it exists
if (task.properties[steps.config.PROPS.dueDate].date.end) {
let endDate = moment.parseZone(task.properties[steps.config.PROPS.dueDate].date.end)
endDate.add(…steps.config.INTERVALS[task.properties[steps.config.PROPS.interval].select.name])
let endDateFormat = DATE_TIME_REGEX.test(task.properties[steps.config.PROPS.dueDate].date.end) ? “YYYY-MM-DDTHH:mm:ss.SSSZ” : “YYYY-MM-DD” // Date only or Date & Time
patch.properties[steps.config.PROPS.dueDate].date.end = endDate.format(endDateFormat)
}

const updatedTaskResp = await axios({
method: “PATCH”,
url: https://api.notion.com/v1/pages/${task.id},
headers: {
“Content-Type”: “application/json”,
“Authorization”: Bearer ${steps.config.API_TOKEN}, // API KEY
“Notion-Version”: “2021-05-13”
},
data : JSON.stringify(patch)
}).catch(err => {
console.log(err.response.data)
throw err
})
this.updatedTasks.push(updatedTaskResp.data)
}
console.log(“Update complete!”)
console.log(‘Workflow finished :white_check_mark:’)