javascript icon indicating copy to clipboard operation
javascript copied to clipboard

[SDK-812] Next Clerk incompatible with app router + export output

Open ozyman42 opened this issue 2 years ago • 3 comments

  • [x] Review the documentation: https://clerk.com/docs
  • [x] Search for existing issues: https://github.com/clerkinc/javascript/issues
  • [x] Go through package changelog files.
  • [ ] Provide the Frontend API key from your application dashboard.

Package + Version

  • [ ] @clerk/clerk-js
  • [ ] @clerk/clerk-react
  • [x] @clerk/nextjs 4.21.15
  • [ ] @clerk/remix
  • [ ] @clerk/types
  • [ ] @clerk/themes
  • [ ] @clerk/localizations
  • [ ] @clerk/clerk-expo
  • [ ] @clerk/backend
  • [ ] @clerk/clerk-sdk-node
  • [ ] @clerk/shared
  • [ ] @clerk/fastify
  • [ ] @clerk/chrome-extension
  • [ ] gatsby-plugin-clerk
  • [ ] build/tooling/chore
  • [ ] other:

Dependencies + versions

{
  "name": "poc-clerk-next-broken",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@clerk/nextjs": "^4.21.15",
    "@types/node": "20.4.2",
    "@types/react": "18.2.14",
    "@types/react-dom": "18.2.7",
    "autoprefixer": "10.4.14",
    "eslint": "8.44.0",
    "eslint-config-next": "13.4.9",
    "next": "13.4.9",
    "postcss": "8.4.25",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "tailwindcss": "3.3.2",
    "typescript": "5.1.6"
  }
}

Browser/OS

NextJS (browser / node)

Description

When using the Next 13 app router and setting the Next config output to export, then trying to add in the ClerkProvider results in the error

Error: Clerk: auth() and currentUser() are only supported in App Router

image

Demo repo https://github.com/ozyman42/demo-clerk-next-bug If you comment out line 3 in the next.config.js then the error goes away,

SDK-812

ozyman42 avatar Jul 13 '23 10:07 ozyman42

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.

clerk-cookie avatar Aug 12 '23 12:08 clerk-cookie

remove "stale" label

ozyman42 avatar Aug 13 '23 16:08 ozyman42