-
Notifications
You must be signed in to change notification settings - Fork 29.4k
Description
What version of Next.js are you using?
11.1.2
What version of Node.js are you using?
v15.14.0
What browser are you using?
Firefox, Chrome
What operating system are you using?
macOS
How are you deploying your application?
Vercel
Describe the Bug
I'm using auth0 integration with next.js that generates some endpoints in the NextJS
API layer to which i navigate from the front end when I have to perform auth stuff like log in, logout etc
so I have /api/auth/login
/api/auth/logout
automatically generated by @auth0/nextjs-auth0
What happen:
if I use a simple <a>
tag everything works just fine but of course ESLint sees it as an internal page, so it fails passing the checks because it suggests me to use <Link>
instead of an <a>
(https://nextjs.org/docs/messages/no-html-link-for-pages)
If I use <Link>
i get an error:
Uncaught (in promise) Error: Failed to load script: /_next/static/chunks/pages/api/auth/%5B...auth0%5D.js
because it is not a page. `
Expected Behavior
I expect to be able to navigate also to api routes.
Or
I expect the error documentation to have some information regarding this scenario.
To Reproduce
- Create a new next project
- Create a dynamic api route that creates several endpoints, each endpoint redirects you somewhere export it like
pages/api/[...something].js
- Try to link to the an api route just created, using the
<Link>
components