Next JS 12 Giving 404 Error for Invalid Static Route JSON File

39 Views Asked by At

I have a website using NextJS 12.3.1. Website is SSG and hosted on a server. When Navigating Between Statically Generated Pages using Static Routes. I see this Error in Console and Network Tab with 404 Error. It tries to fetch the URL /_next/data/q1YJR6lidq9x7sroWHl-4/news/%5Bpid%5D.json?pid=%5Bpid%5D From the Server, but as it's an invalid file with [pid].json name, Server returns 404 Error.

Similarly requests to /_next/data/q1YJR6lidq9x7sroWHl-4/news/undefined.json?pid=undefined files can be seen.

This happens when reloading or opening the page and Navigating programetically using the component.

 <Link href={`/news/${uri}`}>
                <a className="button">Read</a>
 </Link>

Cleared Cache in Server, but seeing the error.

0

There are 0 best solutions below