Error with dynamic routes when building

Hi, so I'm getting an error when building that doesn't happen when using localhost.

Im using Next 13.

So the website I'm building has normal pages and also has a landing page section, so i created a page type called learn for the landing pages.

In localhost I can go to the landing page I created, but when I build it gives me this error:
Error: Failed to collect page data for /learn/[uid]

In next.js I created a folder called learn and added a folder called [uid] and inside that I created a file called page.js and added the code snippets that prismic gave me for the learn page type.

In prismicio file I added this:

const routes = [
  {
    type: "homepage",
    path: "/",
  },
  {
    type: "learn",
    path: "/learn/:uid",
  },
  {
    type: "page",
    path: "/:uid",
  },

];

Does anyone know what could cause this error?

Thanks

Hi @gladysmhenriquez ,

Welcome to the community! I'll be happy to help.

We have a document about creating dynamic routes as you suggested on youtube:

But if this isn't working for you can you share with me the code for your dynamic learn pages? Also can you show me your file structure of your project?

Thanks.