ISR or SSR returns null on remote

25 views Asked by At

I have a question for you. I tried a page with ISR, which does not work on the remote.

export async function getStaticPaths() {
    return {
      paths: [],
      fallback: "blocking"
    };
  };

  export const getStaticProps = async (context: { params: { slug?: string } }) => {
    const eventSlug = context.params?.slug as string;

    const eventProps = await getEventProps(eventSlug)
    const globalData = await fetchGlobalData()

    return {
      props: {
        ...eventProps,
        ...globalData,
      }
    }
  }

If I try it locally it works great. But when I try it on the published site, the data it retrieves from _next/data/.../example.json brings null and then I end up fetching the API with CSR.

The problem is that it makes the request to the API because the statically generated data is null.

I replaced ISR with SSR, and I have the same problem. The data arrives in null and ends up making a request to the API that it shouldn't.

Any ideas?

0

There are 0 answers