Netlify routing all my dynamic routes to a 404? ( NEXT.JS )

7:11:16 PM: {
7:11:16 PM: from: ‘/posts/:slug’,
7:11:16 PM: to: ‘/server/pages/404.html’,
7:11:16 PM: status: 404,
7:11:16 PM: force: false
7:11:16 PM: },

Not sure why it is happening. On build time in my netlify logs. It routers all my dynamic routes ( retrieved with getStaticProps()) to a 404.

I can’t imagine this is the default behavior, I must be doing something wrong?

my ‘pages’ directory has a folder called “posts” and a file in that called “[slug].tsx” . Works perfectly on local.

It does say that it has created the pages:
7:42:17 PM: └ ● /posts/[slug] 526 B 81 kB
7:42:17 PM: ├ /posts/hydro-therapy-pool
7:42:17 PM: ├ /posts/independant-living-centre
7:42:17 PM: ├ /posts/paul
7:42:17 PM: └ [+4 more paths]

but I just cannot access them becuase it will give a 404 because of the redirect.

Returns a 200 now that I changed “getStaticPaths()” fallback to ‘blocking’.
But now it will try to find a route for any slug I put into the url and returns an error instead of a 404.
I need fallback to true!

1 Like

I need more information. Can you please provide a site you are referring to?

I strongly suggest you give it a thorough read through and see if this fixes your problem:

if not, please post again, and we’ll try and troubleshoot.