I am trying Commerce js with NextJS in the commerce.js file everything works well and I have all the return data. But when I import the data from commerce.js file getStaticProps return undefine
import { client } from '../utils/commerce'
const getStaticProps = async () => {
const commerce = client
const { data } = await commerce.products.list()
return {
props: {
products: data
}
}
}
export default function Home({ products }) {
console.log(products)
return (
<> <div> Hello </div> </>
)
}
The console.log(products) return undefine Can someone help me understand the problem, please?
Commerce.js file
import Commerce from '@chec/commerce.js'
export const client = new Commerce(process.env.NEXT_PUBLIC_CHEC_PUBLIC_API_KEY, true)