Pages don't get build in Production only in Development

Hey,
I have an issue with my NEXT.JS & Prismic project, where pages only get build when running yarn dev but Prismic returns null when running yarn build.

Here is the link to the repo: https://github.com/hejsfj/mateo-website

This is how I am querying the page:

export async function getPage(slug, previewData) {
  const data = await fetchAPI(
    
  query PageBySlug($slug: String!, $lang: String!) {
    page(uid: $slug, lang: $lang) {
      title
      body {
          __typename
          ...on PageBodyPlain_hero{
            type
            label
            primary{
              section_title
            }
          }
          ...on PageBodyText{
            type
            label
            primary{
              section_description
            }
          }
        }
      _meta {
        uid
      }
    }

  }
  `,
    {
      previewData,
      variables: {
        slug,
        lang: API_LOCALE,
      },
    }
  );
  return data;
}

Thats how I am consuming the data on the page:

export async function getStaticProps({ params, preview = false, previewData }) {
  const data = await getPage(params.page, previewData);
  return {
    props: {
      preview,
      page: data?.page ?? null,
    },
  };
}

export async function getStaticPaths() {
  const allPages = await getAllPagesWithSlug();
  return {
    paths: allPages?.map(({ node }) => `/${node._meta.uid}`) || [],
    fallback: true,
  };
}

data?.page is undefined when deploying for some reason. When running with yarn dev this works just as desired.

Does someone know why this is the case?

Hello, Seb. Welcome to the Community!

I've tried downloading your project, seems like I would need the .env variables to test it locally. If you could share this info with me, you can send it via dm.

I'm curious to see how the page URLs are generated; I don't see the params being passed to getStaticPaths

Hi Sebastian,

Are you still having this issue?

What errors are you seeing in the console?