Immutable solution version
Error: Clerk: auth() and currentUser() are only supported in App Router (/app directory).
Complete solution
Context
'Clerk: auth() and currentUser() are only supported in App Router (/app directory)' even though the code is in the app directory.
Verified resolution
Reporters found the cause is calling auth() outside a request scope: e.g. at module level in a shared /lib helper, a stale 'src' folder confusing route detection, or calling it during module init of an SSR client factory instead of inside the component/handler. Fix: call auth() inside the React component or request handler, not at module scope.
Evidence
In gh:clerk/javascript#1642 (https://github.com/clerk/javascript/issues/1642), the question was: 'Clerk: auth() and currentUser() are only supported in App Router (/app directory)' even though the code is in the app directory. The verified resolution: Reporters found the cause is calling auth() outside a request scope: e.g. at module level in a shared /lib helper, a stale 'src' folder confusing route detection, or calling it during module init of an SSR client factory instead of inside the component/handler.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_8BEAJNa96BoIOqSmY8QKgg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Error: Clerk: auth() and currentUser() are only supported in App Router (/app directory). <span>— Vectle</span></a>