Next JS Serverless Function Crash on Unknown Route

I have recently built a NextJS-based project and deployed it on Everything is fine at first, however, while visiting the unknown route, it returns the following error message:

I have no idea what’s going on since I didn’t use the serverless function/backend services (I have also removed the api folder, unfortunately, it didn’t solve the problem).

Here is also my GitHub code: New tab (

I have also tried adding _redirects file with the following content:

/*    /index.html   200

It works, however, all the styles (CSS) are messed up and buttons become disfunction :frowning:

Creating a 404.tsx and 500.tsx in the pages dir didn’t work for me too.

Any suggestions will be appreciated :smiley:


Hi there,

After struggling for a few hours, I am finally able to solve this problem by adding the @netlify/plugin-nextjs dependency and edit the build command next build && next export.