TypeError: $w(...).getProduct is not a function

Cant seem to get the function getProduct to work. just get errors. I want to check the product title and a users role and hide the product page if the don’t have the relevant role. but now I’m stuck on trying to get the product name.

.then((product) => {
let productName = product.name