No documents were returned | Next JS

Hello. I have been trying to use Prismic for a while, but I can not get it to return documents.

The current code I'm using is:

import { createClient } from "prismicio";
import { SliceZone } from "@prismicio/react";
import { components } from "slices";

const HomePage = ({ page }: { page: any }) => {
  return (
    <>

      <SliceZone slices={page.data.slices} components={components}></SliceZone>
    </>
  );
};
export default HomePage;

export async function getStaticProps({
  locale,
  previewData,
}: {
  locale: string;
  previewData: any;
}) {
  const client = createClient({ previewData });
  const page = await client.getByUID("home", "home", {
    lang: locale === "en" ? "en-us" : "es-mx",
  });

  return {
    props: {
      page,
    },
  };
}

My document config is the next:

Any help would be appreciated.

Damn, I added a UID field to the document and it worked... Leaving it if another noob has the same problem.

1 Like