vercel/next.js

Does calling unauthorized() in route handler, render unauthorized.tsx?

patelvivekdev opened this issue · 1 comments

Link to the code that reproduces this issue

https://github.com/patelvivekdev/latest-canary

To Reproduce

https://latest-canary.vercel.app/api/unauthorized

This is the Route handler that called with unauthorized()

Current vs. Expected behavior

As per the docs, using unauthorized API in Route handlers should renter unauthorized.tsx.

But when I tried that, it did not render the UI.

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home
  Available memory (MB): 16069
  Available CPU cores: 20
Binaries:
  Node: 20.16.0
  npm: 10.8.1
  Yarn: N/A
  pnpm: 9.12.0
Relevant Packages:
  next: 15.1.1-canary.4 // Latest available version is detected (15.1.1-canary.4).
  eslint-config-next: 15.1.1-canary.4
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next dev (local), Vercel (Deployed)

Additional context

https://nextjs.org/docs/app/api-reference/functions/unauthorized#fetching-data-with-route-handlers

image