Hi all,
I created a domain redirect in the nextjs config file to redirect the home page “/” to the “/index” page.
After working on a new version of the app, this internal redirect wasn’t needed anymore.
The issue is even after removing the redirect, and even after completely deleting the “/index” route from the app folder, that route is still up on production.
I deleted the vercel data cache, and rebuilt the website many time, but the issue is still popping. That route is doomed to the abyss, so I am just using “/index-grid” route instead haha.
I just wanted to know if anyone popped into the same issue. I might try to reproduce the issue when I get time.
Hi, and welcome @jazsouf!
That is odd. Do you happen to have any redirects set-up that could be causing this?
Hi pawlean, thanks for taking the time to answer.
No I don’t have any redirects in my config.
Actually I just tried to reproduce the issue.
Created a new repo, added a “/index” route. But I got a webpack error on build:
Error occurred prerendering page "/index". Read more: https://nextjs.org/docs/messages/prerender-error
TypeError: Cannot read properties of undefined (reading 'clientModules')
at /Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:16:23728
at /Users/sfn/Repos/redirects-test/node_modules/next/dist/server/lib/trace/tracer.js:191:62
at /Users/sfn/Repos/redirects-test/node_modules/next/dist/server/lib/trace/tracer.js:140:36
at NoopContextManager.with (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
at ContextAPI.with (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
at NoopTracer.startActiveSpan (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18093)
at ProxyTracer.startActiveSpan (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:18854)
at /Users/sfn/Repos/redirects-test/node_modules/next/dist/server/lib/trace/tracer.js:122:103
at NoopContextManager.with (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:7062)
at ContextAPI.with (/Users/sfn/Repos/redirects-test/node_modules/next/dist/compiled/@opentelemetry/api/index.js:1:518)
Now I wonder if it’s actually naming the route “/index” specifically that’s causing this issue. Because, if I change the name of the folder to something else like “/index-x” for example, the build goes through without an error.
Maybe there is some conflict with the pages router that use index.js to define routes?
Here is the repo for reference: GitHub - jazsouf/redirects-test