Skip to content

Routing failed. TypeError: Cannot read properties of undefined (reading 'pagePath' #3772

Open
@MisterJimson

Description

@MisterJimson

Preliminary Checks

Reproduction

don't have a reproduction

Publishable key

pk_live_Y2xlcmsud2l0aHRlcm1pbmFsLmNvbSQ

Description

Steps to reproduce:

  1. Setup NextJS & Clerk, similar to https://clerk.com/docs/quickstarts/nextjs
  2. Deploy to a hosted environment. (In my case, AWS, Lambda, and SST)
  3. Log in
  4. Log out

Expected behavior:
You see your login page

Actual behavior:

  • Routing failed. TypeError: Cannot read properties of undefined (reading 'pagePath') at du (file:///var/task/packages/dashboard/middleware.mjs:56:3273) at uu (file:///var/task/packages/dashboard/middleware.mjs:56:3128) at cu (file:///var/task/packages/dashboard/middleware.mjs:56:3063) at file:///var/task/packages/dashboard/middleware.mjs:56:2570 at Object.protect (file:///var/task/packages/dashboard/middleware.mjs:56:6831) at pu.afterSignInUrl (file:///var/task/packages/dashboard/middleware.mjs:56:7570) at file:///var/task/packages/dashboard/middleware.mjs:56:4648 at AsyncLocalStorage.run (node:async_hooks:338:14) at Object.g (file:///var/task/packages/dashboard/middleware.mjs:56:4630) at async file:///var/task/packages/dashboard/middleware.mjs:23:9303

The above error is thrown by the Clerk SDK, triggering the project's Error Boundary.

My middleware file is quite simple.

export default clerkMiddleware((auth, request) => {
  if (isProtectedRoute(request)) {
    auth().protect();
  }

  return NextResponse.next();
});

Environment

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M3
    Memory: 77.17 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.0 - ~/Library/Caches/fnm_multishells/9874_1721250512495/bin/node
    npm: 10.2.4 - ~/Library/Caches/fnm_multishells/9874_1721250512495/bin/npm
    pnpm: 9.4.0 - ~/Library/Caches/fnm_multishells/9874_1721250512495/bin/pnpm
    bun: 1.1.16 - ~/.bun/bin/bun
  Browsers:
    Chrome: 126.0.6478.183
    Safari: 17.5
  npmPackages:
    @clerk/nextjs: ^5.0.12 => 5.2.3
    @heroicons/react: ^2.1.1 => 2.1.5
    @hookform/resolvers: ^3.4.2 => 3.9.0
    @knocklabs/client: 0.10.11 => 0.10.11
    @knocklabs/react: 0.2.25 => 0.2.25
    @radix-ui/react-accordion: ^1.1.2 => 1.2.0
    @radix-ui/react-alert-dialog: ^1.0.5 => 1.1.1
    @radix-ui/react-aspect-ratio: ^1.0.3 => 1.1.0
    @radix-ui/react-avatar: ^1.0.4 => 1.1.0
    @radix-ui/react-checkbox: ^1.1.1 => 1.1.1
    @radix-ui/react-collapsible: ^1.0.3 => 1.1.0
    @radix-ui/react-context-menu: ^2.1.5 => 2.2.1
    @radix-ui/react-dialog: ^1.0.5 => 1.1.1
    @radix-ui/react-dropdown-menu: ^2.0.6 => 2.1.1
    @radix-ui/react-hover-card: ^1.0.7 => 1.1.1
    @radix-ui/react-label: ^2.0.2 => 2.1.0
    @radix-ui/react-menubar: ^1.0.4 => 1.1.1
    @radix-ui/react-navigation-menu: ^1.1.4 => 1.2.0
    @radix-ui/react-popover: ^1.0.7 => 1.1.1
    @radix-ui/react-progress: ^1.0.3 => 1.1.0
    @radix-ui/react-radio-group: ^1.1.3 => 1.2.0
    @radix-ui/react-scroll-area: ^1.0.5 => 1.1.0
    @radix-ui/react-select: ^2.0.0 => 2.1.1
    @radix-ui/react-separator: ^1.0.3 => 1.1.0
    @radix-ui/react-slider: ^1.1.2 => 1.2.0
    @radix-ui/react-slot: ^1.0.2 => 1.1.0
    @radix-ui/react-switch: ^1.0.3 => 1.1.0
    @radix-ui/react-tabs: ^1.1.0 => 1.1.0
    @radix-ui/react-toast: ^1.1.5 => 1.2.1
    @radix-ui/react-toggle: ^1.0.3 => 1.1.0
    @radix-ui/react-toggle-group: ^1.0.4 => 1.1.0
    @radix-ui/react-tooltip: ^1.0.7 => 1.1.2
    @sentry/nextjs: ^7.114.0 => 7.118.0
    @spotlightjs/spotlight: ^2.0.0 => 2.0.0
    @tanstack/react-query: ^5.40.0 => 5.51.1
    @tanstack/react-table: 8.19.2 => 8.19.2
    @terminal/cdn: workspace:* => 0.0.0
    @terminal/config: workspace:* => 0.0.0
    @terminal/core: workspace:* => 0.0.0
    @terminal/generated: workspace:* => 0.0.0
    @terminal/schemas: workspace:* => 0.0.0
    @terminal/sdk: workspace:* => 0.0.0
    @terminal/spotlight-logger: workspace:* => 0.0.1
    @types/node: ^20 => 20.14.11
    @types/papaparse: ^5.3.14 => 5.3.14
    @types/react: ^18.3.3 => 18.3.3
    @types/react-dom: ^18.3.0 => 18.3.0
    autoprefixer: ^10.0.1 => 10.4.19
    axios: ^1.6.7 => 1.7.2
    class-variance-authority: ^0.7.0 => 0.7.0
    clsx: ^2.0.0 => 2.1.1
    cmdk: ^1.0.0 => 1.0.0
    date-fns: ^3.0.0 => 3.6.0
    embla-carousel-react: 8.1.6 => 8.1.6
    eslint: ^8 => 8.57.0
    eslint-config-next: 14.2.5 => 14.2.5
    google-maps-react-markers: ^2.0.10 => 2.0.10
    jotai: ^2.6.4 => 2.9.0
    lucide-react: ^0.407.0 => 0.407.0
    next: 14.2.5 => 14.2.5
    next-themes: ^0.3.0 => 0.3.0
    nuqs: ^1.17.4 => 1.17.4
    papaparse: ^5.4.1 => 5.4.1
    postcss: ^8 => 8.4.39
    posthog-js: ^1.131.3 => 1.146.1
    react: ^18.3.1 => 18.3.1
    react-day-picker: ^8.10.0 => 8.10.1
    react-dom: ^18.3.1 => 18.3.1
    react-error-boundary: ^4.0.12 => 4.0.13
    react-hook-form: ^7.51.5 => 7.52.1
    react-resizable-panels: ^2.0.5 => 2.0.20
    sonner: ^1.4.41 => 1.5.0
    svix-react: ^1.11.0 => 1.11.0
    tailwind-merge: ^2.2.1 => 2.4.0
    tailwindcss: ^3.3.0 => 3.4.4
    tailwindcss-animate: ^1.0.7 => 1.0.7
    typescript: ^5.5.2 => 5.5.3
    vaul: ^0.9.0 => 0.9.1
    zod: ^3.23.8 => 3.23.8

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions