1

My app is created on next js and strapi. Deployed on Vercel.

When I create new entries with the super admin role it works fine on dev and production but if I try this with a Author/Editor role, I get 404 error until I redeploy the app on Vercel.

This only on dynamic pages. I don't really know what part of the code to show you to help understand my specific case.

export async function getStaticPaths() {
  const spectacles = await fetchAPI("/spectacles")

  return {
    paths: spectacles.map((spectacle) => ({
      params: {
        slug: spectacle.slug,
      },
    })),
    fallback: false,
  }
}

export async function getStaticProps({ params }) {
  const spectacle = (await fetchAPI(`/spectacles?slug=${params.slug}`))[0]

  const [spectacles, categories] = await Promise.all([
    fetchAPI("/spectacles"),
    fetchAPI("/categories"),
  ])
  return {
    props: { spectacle: spectacle, spectacles, categories },
    revalidate: 1,
  }
}
Rom-888
  • 681
  • 2
  • 9
  • 30
  • Does this answer your question: [How to add new pages without rebuilding an app with +150k static pages?](https://stackoverflow.com/questions/66036558/how-to-add-new-pages-without-rebuilding-an-app-with-150k-static-pages)? You can use `fallback: true` or `fallback: blocking` in `getStaticPaths` so that the new pages are generated. – juliomalves Oct 14 '21 at 21:15
  • It doesn't work for me. If I use fallback: true, my build send me that error : TypeError: c.props.href.startsWith is not a function – Rom-888 Oct 18 '21 at 10:26
  • Does the same happen with `fallback: 'blocking'`? With `fallback: true` you'll need to handle the scenario when the page is actually showing the fallback. See [Fallback Pages](https://nextjs.org/docs/basic-features/data-fetching#fallback-pages). – juliomalves Oct 18 '21 at 17:07
  • Blocking allows me to build without the error, but I still need to redeploy ; in production only. In dev mode the update is automatically done – Rom-888 Oct 18 '21 at 20:27

0 Answers0