At first glance, there are a couple of things wrong:
- you do not need to declare the function async if you are not using await. Delete it
- the returned result of a query is an object, with , amongst others, 1 key called “items”, which holds an array of rows. That’s the “real” data. So you should test for result.items.length.
- you could have easily found this out yourself if you just put in a console.log or console.info here and there. That’s what they are made for: debugging.
Happy hunting