Query a database within a hook

Hi, I’m needing to do a query within a hook, but it just doesn’t seem to running at all - “queried” is never displayed on the console. Can anyone help? Thanks!

export function results_afterInsert(item, context) {

wixData.query(“pretendsessions2”)
.limit(1000)
.find()
.then( (results) => {
console.log(“queried”);
})

return item;

}

hi Alexia,

I see that this post is 5 days old. Were you able to solve the issue?
Try adding console.log(“afterInsert”, item); before the query and see if its visible in the developer console.

In addition, try refreshing your editor to see if it fixes the issue.

Hi, Alexia

Maybe this can help you.