Site - https://harsh-in-sec.netlify.app/
I followed https://www.netlify.com/blog/2020/11/30/how-to-deploy-next.js-sites-to-netlify/ doc in order to deploy my nextjs application. The application is rendering fine. But when i try to go to the blog details page which uses dynamic slug in its route, its giving 404.
sample detail url - https://harsh-in-sec.netlify.app/_next/data/3tP0C7p4R0lsZSRP4C2sp/blog/posts/blog.json?slug=blog
This ^^ is giving 404 after deploying on Netlify but “http://localhost:3000/_next/data/development/blog/posts/blog.json?slug=blog” is working perfectly fine on local. How can I fix it? Will _redirects help here? if yes, how can i configure it?
You’ve got a redirect causing issues:
That’s sending everything on that path to a 404 unless the file already exists. This might have to do something with how you’ve configured the site, but at the same time, could also be one of the many issues with Next.js on Netlify currently. Should be fixed in a few weeks when the new runtime comes out.
Thanks for getting back on this. I haven’t used any custom redirects, although i tried to add but eventually none of them worked so I removed it. Also, like i mentioned above, the application is rendering perfectly fine on my local. I have been chasing this issue for more than a month now and i am not getting solution for the same. Can you tell me from where did u find this redirect? Also, is there an ETA on the fix or any workaround for this issue? This is crucial as without it, my application will be useless!
It’s from our database, though you could also find it by downloading the
netlify.toml from the UI.
The fix is Next Runtime v5 which is currently in beta, scheduled for a release candidate in February and GA in March.