unauthenticatedAdmin.admin.rest.resources.Product.all

When I try to fetch products using

unauthenticatedAdmin.admin.rest.resources.Product.all() , it throws an error saying cannot read properties of undefined all()

This code executes on local but ducring production it throws the error. I cross checked the api and secret keys.

let products = await unauthenticatedAdmin.admin.rest.resources.Product.all({
session: unauthenticatedAdmin.session,
limit: 50,
page_info: next_page_key,
});