I have getStaticProps functions on my homepage and news page to fetch single pages which always worked. But then I added a page with getServerSideProps and now nothing works not even my homepage which always did work.
Here is the fetch function for the homepage which I never changed
Welcome to the Prismic community, and thanks for reaching out to us.
This error usually comes when you conflict between the name of types in your linkresolver or routeResolver function and the name given in Prismic docs. Can you paste the link resolver function and the name of your repo? You can send a repo name by private message.
How and where do I do that? I am using nextjs so it's just the pages directory.
I just have files in the pages directory called index, about, news etc.
I have checked your code and repository.
To run the code correctly, you need to remove the page route from the prismic.io file because your repository doesn't have any page Custom Type. The correct routes is:
Hey, a similar issue happened to us today. We added a new customType and immediately the client functions stopped working because of the that error - Unknown type.
The solution was kind of unexpected - we needed to publish the first document of that type (even though we have the preview for drafts configured).
It seems like a bug to me. It should accept the valid customType value even if there are no documents of that type published. Otherwise any content editor can break the whole website if they remove all docs of any type (which is a rare scenario, but completely realistic and valid from the content editor perspective).
Your repository Custom Type name and your routes should match each other. The routes and API only have the published documents. To get to work, you need to publish the docs if you added them in the routes.