Help - Next.js E-commerce Hosting problem

Hi, Can someone help? I have deployed the Strapi backend to Render, but when I tried to launch my front-end to Vercel, it cannot load the JSON file from the hosted URL

I am following the next.js E-commerce starter

Public Strapi end-point
https://strapi-5xyl.onrender.com/categories

The error I got from the next.js app is
TypeError: categories.map is not a function
This error happened while generating the page. Any console logs will be displayed in the terminal window.

I am not familiar with next.js.
Since https://strapi-5xyl.onrender.com/categories can return json object, I think the issue is not in Render side.
Does this help? javascript - How to fix "TypeError: categories.map is not a function" error in React - Stack Overflow

Are you getting the categories inside your page via GetStaticProps or GetServerSideProps?

If not, maybe its because you still don’t have categories in you initial render.

1 Like

I found the solution already, I need to set the right env variable on the Vercel.