Next.js Discord

Discord Forum

Next.js 14 app router Intercepting Routes error

Unanswered
renee posted this in #help-forum
Open in Discord
I set a link in products/electronics/computers/page.tsx for navigate to products/foods/page.tsx route, and create products/electronics/computers/(..)(..)foods/page.tsx to intercept url /products/foods, but when i click the link in products/electronics/computers/page.tsx the terminal show the error like this:
TypeError: Expected "1" to be a string
    at /home/wsl2/route-example/node_modules/next/dist/compiled/path-to-regexp/index.js:237:19
    at prepareDestination (/home/wsl2/route-example/node_modules/next/dist/shared/lib/router/utils/prepare-destination.js:209:18)
    at handleRoute (/home/wsl2/route-example/node_modules/next/dist/server/lib/router-utils/resolve-routes.js:501:94)
    at handleRoute (/home/wsl2/route-example/node_modules/next/dist/server/lib/router-utils/resolve-routes.js:225:46)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async resolveRoutes (/home/wsl2/route-example/node_modules/next/dist/server/lib/router-utils/resolve-routes.js:539:28)
    at async handleRequest (/home/wsl2/route-example/node_modules/next/dist/server/lib/router-server.js:211:96)
    at async requestHandlerImpl (/home/wsl2/route-example/node_modules/next/dist/server/lib/router-server.js:377:13)
    at async Server.requestListener (/home/wsl2/route-example/node_modules/next/dist/server/lib/start-server.js:140:13)

1 Reply

I use next/link to navigate
        <Link href="/products/foods" className="underline-offset-2 underline">
          Go to intercepting Foods page
        </Link>