TanStack React Start Quickstart (beta) setup causes AuthenticateContext.getCookie error and SignInButton unresponsiveness
Preliminary Checks
-
[x] I have reviewed the documentation: https://clerk.com/docs
-
[x] I have searched for existing issues: https://github.com/clerk/javascript/issues
-
[x] I have not already reached out to Clerk support via email or Discord (if you have, no need to open an issue here)
-
[x] This issue is not a question, general help request, or anything other than a bug report directly related to Clerk. Please ask questions in our Discord community: https://clerk.com/discord.
Reproduction
https://github.com/taariqelliott/demo-app
Publishable key
pk_test_ZnVua3ktdGV0cmEtNjIuY2xlcmsuYWNjb3VudHMuZGV2JA
Description
Steps to reproduce:
- Follow the Clerk TanStack React Start Quickstart (beta) setup guide exactly as shown
- Run the project
- You will get the following error: Cannot read properties of undefined (reading 'get') at AuthenticateContext.getCookie (/Users/taariqelliott/Desktop/2/node_modules/@clerk/backend/src/tokens/authenticateContext.ts:311:38) ... 8 lines matching cause stack trace ...
- Apply the following workaround:
- Run
bun add [email protected] - Delete
node_modulesandbun.lock - Run
bun i - The page will now load normally, but clicking the SignInButton does not reroute to the Clerk sign-in page
- Run
- What works:
- Copy the
package.jsonfrom https://github.com/clerk/clerk-tanstack-react-start-quickstart - Paste it into your own app’s
package.json - Delete
node_modulesand runbun i - Then delete
node_modulesagain, restore your originalpackage.json, and runbun ionce more - Now the SignInButton will reroute to the Clerk sign-in page
- Copy the
Note: If you see the <TanStackRouterDevtoolsPanel /> in the bottom right corner then you set the project up correctly and the button should reroute you to the Clerk sign-in page.
Expected behavior: The setup guide should work as written without requiring additional dependency fixes or manual package.json swaps. The SignInButton should function immediately after following the Quickstart instructions.
Actual behavior:
Running the setup as instructed causes a runtime error from AuthenticateContext.getCookie. After applying the workaround, the app loads but the SignInButton remains unresponsive until dependencies are reinstalled using the workaround process
Environment
System:
OS: macOS 26.1
CPU: (12) arm64 Apple M2 Pro
Memory: 271.53 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.12.0 - /Users/taariqelliott/.nvm/versions/node/v22.12.0/bin/node
Yarn: 4.9.2 - /Users/taariqelliott/.nvm/versions/node/v22.12.0/bin/yarn
npm: 11.5.2 - /Users/taariqelliott/.nvm/versions/node/v22.12.0/bin/npm
pnpm: 10.14.0 - /Users/taariqelliott/.nvm/versions/node/v22.12.0/bin/pnpm
bun: 1.3.0 - /Users/taariqelliott/.bun/bin/bun
Deno: 2.3.1 - /Users/taariqelliott/.deno/bin/deno
Watchman: 2025.10.27.00 - /opt/homebrew/bin/watchman
Browsers:
Safari: 26.1
npmPackages:
@clerk/tanstack-react-start: ^0.26.9 => 0.26.9
@tailwindcss/vite: ^4.0.6 => 4.1.17
@tanstack/nitro-v2-vite-plugin: ^1.132.31 => 1.133.19
@tanstack/react-devtools: ^0.7.0 => 0.7.11
@tanstack/react-router: ^1.132.0 => 1.134.4
@tanstack/react-router-devtools: ^1.132.0 => 1.134.4
@tanstack/react-router-ssr-query: ^1.131.7 => 1.135.0
@tanstack/react-start: ^1.132.0 => 1.134.6
@tanstack/router-plugin: ^1.132.0 => 1.134.6
@testing-library/dom: ^10.4.0 => 10.4.1
@testing-library/react: ^16.2.0 => 16.3.0
@types/node: ^22.10.2 => 22.19.0
@types/react: ^19.2.0 => 19.2.2
@types/react-dom: ^19.2.0 => 19.2.2
@vitejs/plugin-react: ^5.0.4 => 5.1.0
jsdom: ^27.0.0 => 27.1.0
lucide-react: ^0.544.0 => 0.544.0
react: ^19.2.0 => 19.2.0
react-dom: ^19.2.0 => 19.2.0
srvx: 0.8.15 => 0.8.15
tailwindcss: ^4.0.6 => 4.1.17
typescript: ^5.7.2 => 5.9.3
vite: ^7.1.7 => 7.2.2
vite-tsconfig-paths: ^5.1.4 => 5.1.4
vitest: ^3.0.5 => 3.2.4
web-vitals: ^5.1.0 => 5.1.0
I ran into the same issue with the AuthenticateContext.getCookie error.
I'm running it in a Cloudlfare wrangler envrionment.
I traced the function createClerkRequest
var createClerkRequest = (...args) => {
return args[0] instanceof ClerkRequest ? args[0] : new ClerkRequest(...args);
};
The inline if, always returns true fir instanceof ClerkRequest if you pass a node (or Bun) Request.
I assume this has something to do with vite and, and the typeidentification breaking down.
As I'm using Hono, and the @hono/clerk-auth package, I went ahead and copied the createMiddleware function from https://github.com/honojs/middleware/blob/main/packages/clerk-auth/src/clerk-auth.ts. and then changed this:
const clerkClient = createClerkClient({
...rest,
apiUrl,
apiVersion,
secretKey,
publishableKey,
})
const rawReq = c.req.raw;
const frankensteinRequest = {
url: rawReq.url,
method: rawReq.method,
headers: rawReq.headers,
cookies: parseCookies(rawReq.headers.get('cookie')),
}
const requestState = await clerkClient.authenticateRequest(frankensteinRequest as unknown as Request, {
...rest,
secretKey,
publishableKey,
acceptsToken: TokenType.SessionToken,
})
The frankensteinRequest seems to give all the needed info, without triggering the instanceof ClerkRequest to be true.
Hope that helps.
Hello, thanks for reporting!
For the "AuthenticateContext.getCookie error", see https://github.com/clerk/javascript/issues/6996. If you're on Discord, you can visit the TanStack Start thread regarding this error
SignInButton unresponsiveness - known issue in TanStack Start as well, please see https://github.com/TanStack/router/issues/5738. There are workarounds in the comments