You are dealing with Promises using both async/await and code and the .then() method. You should only use one or the other.
Try this at the end:
...
try {
return await wixData.insert('Tasks', toInsert, options)
} catch (error) {
console.error(error)
throw error
}
...
