Skip to content

Conversation

@wobsoriano
Copy link
Member

@wobsoriano wobsoriano commented Oct 9, 2025

🔎 Previews:

What does this solve?

What changed?

  • Updates pages where custom server handler (createClerkHandler) is used and replaced with clerkMiddleware() usage.
  • Updates getAuth(request) to use auth()

Checklist

  • I have clicked on "Files changed" and performed a thorough self-review
  • All existing checks pass

@vercel
Copy link

vercel bot commented Oct 9, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
clerk-docs Ready Ready Preview Oct 17, 2025 5:58pm

💡 Enable Vercel Agent with $100 free credit for automated AI reviews

@wobsoriano wobsoriano marked this pull request as ready for review October 14, 2025 16:21
@wobsoriano wobsoriano requested a review from a team as a code owner October 14, 2025 16:21
@wobsoriano
Copy link
Member Author

Marking this as ready for review ahead of our SDK release today.

@SarahSoutoul
Copy link
Contributor

docs review

@wobsoriano Have added some redirects for the old links here: docs review and left a comment.

The rest looks good to me, but wanna test out the new quickstart first.

@SarahSoutoul
Copy link
Contributor

SarahSoutoul commented Oct 14, 2025

@alexisintech have now given this an extensive review, but wanted to get your eyes on it for final approval.

Quickstart PR associated with this is here: clerk/clerk-tanstack-react-start-quickstart#5.

Think we also need a Dashboard PR to update onboarding docs, if I'm not mistaken @wobsoriano. Happy to do it if it's not in the making.

@manovotny
Copy link
Contributor

manovotny commented Oct 14, 2025

I would prefer @alexisintech gives official approval, but from what I see, this LGTM. 👍

@richardvanbergen
Copy link

@wobsoriano Thank you very much for your hard work on this. I wasn't sure whether to create an issue or if it's a problem with documentation (my setup) but I thought I should at least tell you before you publish an announcement or something. If you want I can create an issue instead.

After adding the middleware

import { clerkMiddleware } from '@clerk/tanstack-react-start/server';
import { createStart } from '@tanstack/react-start';

export const startInstance = createStart(() => {
  return {
    requestMiddleware: [clerkMiddleware()],
  };
});

I get the following on every request:

TypeError: Cannot read properties of undefined (reading 'get')
    at AuthenticateContext.getCookie (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:388:38)
    ... 8 lines matching cause stack trace ...
    at next (/Users/rich/Code/workwings/node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:480:16) {
  cause: TypeError: Cannot read properties of undefined (reading 'get')
      at AuthenticateContext.getCookie (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:388:38)
      at AuthenticateContext.getSuffixedCookie (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:391:17)
      at AuthenticateContext.usesSuffixedCookies (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:252:36)
      at AuthenticateContext.getSuffixedOrUnSuffixedCookie (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:394:14)
      at AuthenticateContext.initCookieValues (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:371:38)
      at new AuthenticateContext (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:237:12)
      at createAuthenticateContext (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:436:10)
      at authenticateRequest (file:///Users/rich/Code/workwings/node_modules/@clerk/backend/dist/chunk-BY3VEEDM.mjs:4994:31)
      at /Users/rich/Code/workwings/node_modules/@clerk/tanstack-react-start/dist/server/clerkMiddleware.js:16:26
      at next (/Users/rich/Code/workwings/node_modules/@tanstack/start-server-core/dist/esm/createStartHandler.js:480:16),
  status: 500,
  statusText: undefined,
  headers: undefined,
  data: undefined,
  body: undefined,
  unhandled: true
}

This is my current package versions. I've checked the PRs and made sure I have the latest clerk libraries but no success:

{
  "name": "[redacted]",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "vite dev --port 3000",
    "build": "vite build",
    "start": "node .output/server/index.mjs",
    "serve": "vite preview",
    "test": "vitest run",
    "format": "biome format",
    "lint": "biome lint",
    "check": "biome check",
    "storybook": "storybook dev -p 6006",
    "build-storybook": "storybook build",
    "machine-translate": "inlang machine translate --project project.inlang"
  },
  "dependencies": {
    "@auth/core": "0.37.0",
    "@clerk/backend": "^2.18.0",
    "@clerk/clerk-js": "^5.100.0",
    "@clerk/clerk-react": "^5.52.0",
    "@clerk/tanstack-react-start": "^0.26.0",
    "@convex-dev/auth": "^0.0.90",
    "@convex-dev/react-query": "0.0.0-alpha.11",
    "@faker-js/faker": "^10.0.0",
    "@orpc/client": "^1.7.5",
    "@orpc/json-schema": "^1.7.5",
    "@orpc/openapi": "^1.7.5",
    "@orpc/server": "^1.7.5",
    "@orpc/tanstack-query": "^1.7.5",
    "@orpc/zod": "^1.7.5",
    "@radix-ui/react-accordion": "^1.2.12",
    "@radix-ui/react-label": "^2.1.7",
    "@radix-ui/react-select": "^2.2.6",
    "@radix-ui/react-slider": "^1.3.6",
    "@radix-ui/react-slot": "^1.2.3",
    "@radix-ui/react-switch": "^1.2.6",
    "@storybook/react-vite": "^9.1.9",
    "@t3-oss/env-core": "^0.13.8",
    "@tailwindcss/vite": "^4.0.6",
    "@tanstack/match-sorter-utils": "^8.19.4",
    "@tanstack/react-devtools": "^0.7.0",
    "@tanstack/react-form": "^1.0.0",
    "@tanstack/react-query": "^5.66.5",
    "@tanstack/react-query-devtools": "^5.84.2",
    "@tanstack/react-router": "^1.132.0",
    "@tanstack/react-router-devtools": "^1.132.0",
    "@tanstack/react-router-ssr-query": "^1.131.7",
    "@tanstack/react-router-with-query": "^1.130.17",
    "@tanstack/react-start": "^1.132.0",
    "@tanstack/react-store": "^0.7.0",
    "@tanstack/react-table": "^8.21.2",
    "@tanstack/router-plugin": "^1.132.0",
    "@tanstack/store": "^0.7.0",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "convex": "^1.27.3",
    "lucide-react": "^0.544.0",
    "nitro": "npm:nitro-nightly",
    "posthog-js": "^1.273.1",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "storybook": "^9.1.9",
    "tailwind-merge": "^3.0.2",
    "tailwindcss": "^4.0.6",
    "tw-animate-css": "^1.3.6",
    "vite-tsconfig-paths": "^5.1.4",
    "zod": "^4.1.11"
  },
  "devDependencies": {
    "@biomejs/biome": "2.2.4",
    "@inlang/cli": "^3.0.0",
    "@inlang/paraglide-js": "2.4.0",
    "@tanstack/devtools-event-client": "^0.3.2",
    "@testing-library/dom": "^10.4.0",
    "@testing-library/react": "^16.2.0",
    "@types/node": "^22.10.2",
    "@types/react": "^19.0.8",
    "@types/react-dom": "^19.0.3",
    "@vitejs/plugin-react": "^5.0.4",
    "jsdom": "^27.0.0",
    "typescript": "^5.7.2",
    "vite": "^7.1.7",
    "vitest": "^3.0.5",
    "web-vitals": "^5.1.0"
  },
  "trustedDependencies": [
    "@clerk/shared",
    "@tailwindcss/oxide",
    "browser-tabs-lock",
    "core-js"
  ]
}

@wobsoriano
Copy link
Member Author

@richardvanbergen there's an upstream issue with a TanStack dependency and the fix is to pin srvx version to 0.8.15. See this integration test fix

@richardvanbergen
Copy link

@wobsoriano Sorry that didn't work I:

  1. Locked the package versions to the versions here.
  2. Deleted the lock file and node modules.
  3. Re-install from scratch.

I still see the same error.

I'm going to try and see if I can make a minimal reproduction repo. if I can't then I'll just migrate my app over to it. If I can I'll post it to clerk/backend issues.

@richardvanbergen
Copy link

Nevermind. I couldn't reproduce in another repo. So I just started deleting stuff from my package.json and trying to get it to match the new repo as best I could. Then it suddenly started working, I don't know what caused it. My guess is some pnpm or vite cache nonsense.

Sorry for the extra chatter and congratulations on a newly shipped feature!

@SarahSoutoul
Copy link
Contributor

@alexisintech have now given this an extensive review, but wanted to get your eyes on it for final approval.

Quickstart PR associated with this is here: clerk/clerk-tanstack-react-start-quickstart#5.

Think we also need a Dashboard PR to update onboarding docs, if I'm not mistaken @wobsoriano. Happy to do it if it's not in the making.

Here you go: https://github.com/clerk/dashboard/pull/7313.

@alexisintech
Copy link
Member

@SarahSoutoul @wobsoriano taking a look now

Copy link
Member

@alexisintech alexisintech left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've posted my review - if you agree with these changes @wobsoriano I can update the quickstart repo to match these changes :)

@SarahSoutoul
Copy link
Contributor

I've posted my review - if you agree with these changes @wobsoriano I can update the quickstart repo to match these changes :)

To both of you @alexisintech @wobsoriano, have updated the Dashboard PR accordingly after the recent changes if you could have another quick link: https://github.com/clerk/dashboard/pull/7313/files. Didn't include the srvx stuff given it's a temporary thing, but doesn't hurt to add it as a callout in the dashboard onboarding too. Let me know thoughts.

@alexisintech
Copy link
Member

I've posted my review - if you agree with these changes @wobsoriano I can update the quickstart repo to match these changes :)

To both of you @alexisintech @wobsoriano, have updated the Dashboard PR accordingly after the recent changes if you could have another quick link: https://github.com/clerk/dashboard/pull/7313/files. Didn't include the srvx stuff given it's a temporary thing, but doesn't hurt to add it as a callout in the dashboard onboarding too. Let me know thoughts.

I'm going to mark this as blocked until we have rob's responses!

@wobsoriano
Copy link
Member Author

@alexisintech @SarahSoutoul tbh I think we can skip the srvx part as we already have plenty of references (discord, github) on why it's not working currently and we can always reference that. I talked to one of the TanStack maintainers and they said they're gonna look into it.

@SarahSoutoul
Copy link
Contributor

I think we might be good to go no? @alexisintech @wobsoriano

@wobsoriano
Copy link
Member Author

merging it!

@wobsoriano wobsoriano merged commit 9cfdb7f into main Oct 17, 2025
7 checks passed
@wobsoriano wobsoriano deleted the rob/tanstack-start-rc branch October 17, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants