Skip to content

Can't use latest Next.js version. Clerk error on Next.js 13.5 #1778

@brycelund

Description

@brycelund

Preliminary Checks

Reproduction / Replay Link

https://github.com/clerkinc/clerk-next-app

Publishable key

N/A

Description

Steps to reproduce:

  1. Clone the Clerk next starter repo
  2. Update Next.js to 13.5.3
  3. Run the app

Expected behavior:
No error is thrown

Actual behavior:
The following error is thrown on every page load

⨯ node_modules/@clerk/nextjs/dist/esm/server/getAuth.js (28:12) @ eval
⨯ Error: Clerk: auth() was called but it looks like you aren't using `authMiddleware` in your middleware file. Please use `authMiddleware` and make sure your middleware matcher is configured correctly and it matches this route or page. See https://clerk.com/docs/quickstarts/get-started-with-nextjs
    at stringify (<anonymous>)

The app still seems to function correctly, but this error is thrown on every request.

There is an open issue here, but there hasn't been any resolution. The issue here seems to be that their middleware.ts is configured incorrectly or in the wrong place. This is not the case with my issue.
clerk/clerk-next-app-router-starter#2

Environment

System:
    OS: macOS 13.4.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 460.48 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.11.0 - ~/.nvm/versions/node/v18.11.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.11.0/bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.11.0/bin/npm
    pnpm: 7.29.3 - ~/.nvm/versions/node/v18.11.0/bin/pnpm
    Watchman: 2023.08.14.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 116.0.5845.187
    Safari: 16.5.1
  npmPackages:
    @clerk/nextjs: ^4.21.8 => 4.21.8 
    @types/node: 20.1.4 => 20.1.4 
    @types/react: 18.2.6 => 18.2.6 
    @types/react-dom: 18.2.4 => 18.2.4 
    autoprefixer: 10.4.14 => 10.4.14 
    classnames: ^2.3.2 => 2.3.2 
    next: ^13.5.3 => 13.5.3 
    postcss: 8.4.23 => 8.4.23 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    tailwindcss: 3.3.2 => 3.3.2 
    typescript: 5.0.4 => 5.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions