-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
chore(examples): Update Clerk server handler usage #5026
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(examples): Update Clerk server handler usage #5026
Conversation
WalkthroughBumps Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant Server as Server\n(defineHandlerCallback)
participant Factory as handlerFactory
participant Clerk as createClerkHandler
participant Start as createStartHandler
participant Handler as startHandler
participant Stream as defaultStreamHandler
Client->>Server: HTTP request (event)
Note over Server: Wrapped by defineHandlerCallback
Server->>Factory: await handlerFactory(defaultStreamHandler)
Factory->>Clerk: createClerkHandler(...)
Clerk->>Start: createStartHandler({ createRouter })
Clerk-->>Factory: awaitable handler
Factory-->>Server: startHandler
Server->>Handler: startHandler(event)
Handler->>Stream: Delegate as needed
Handler-->>Server: Response
Server-->>Client: Response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Pre-merge checks (2 passed, 1 warning)❌ Failed Checks (1 warning)
✅ Passed Checks (2 passed)
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✨ Finishing Touches🧪 Generate unit tests
Comment |
|
View your CI Pipeline Execution ↗ for commit 4d189ad
☁️ Nx Cloud last updated this comment at |
More templates
@tanstack/arktype-adapter
@tanstack/directive-functions-plugin
@tanstack/eslint-plugin-router
@tanstack/history
@tanstack/react-router
@tanstack/react-router-devtools
@tanstack/react-router-ssr-query
@tanstack/react-start
@tanstack/react-start-client
@tanstack/react-start-plugin
@tanstack/react-start-server
@tanstack/router-cli
@tanstack/router-core
@tanstack/router-devtools
@tanstack/router-devtools-core
@tanstack/router-generator
@tanstack/router-plugin
@tanstack/router-ssr-query-core
@tanstack/router-utils
@tanstack/router-vite-plugin
@tanstack/server-functions-plugin
@tanstack/solid-router
@tanstack/solid-router-devtools
@tanstack/solid-start
@tanstack/solid-start-client
@tanstack/solid-start-plugin
@tanstack/solid-start-server
@tanstack/start-client-core
@tanstack/start-plugin-core
@tanstack/start-server-core
@tanstack/start-server-functions-client
@tanstack/start-server-functions-fetcher
@tanstack/start-server-functions-server
@tanstack/start-storage-context
@tanstack/valibot-adapter
@tanstack/virtual-file-routes
@tanstack/zod-adapter
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
examples/react/start-clerk-basic/src/server.ts (1)
9-13: Good refactor to a Clerk-aware handler factory; consider a tiny naming/type hint (optional).handlerFactory is clear enough, but a more explicit name (e.g., createClerkStartHandler) or a type alias can help future maintainers. Optional.
Example lightweight tweak (no behavior change):
-const handlerFactory = createClerkHandler( +// Produces a per-event Start handler wired up with Clerk +const createClerkStartHandler = createClerkHandler( createStartHandler({ createRouter, }), )And update usages accordingly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
examples/react/start-clerk-basic/package.json(1 hunks)examples/react/start-clerk-basic/src/server.ts(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Test
- GitHub Check: Preview
🔇 Additional comments (3)
examples/react/start-clerk-basic/src/server.ts (3)
4-4: Importing defineHandlerCallback is the right move for platform-friendly exports.This aligns the entrypoint with the latest TanStack Start guidance and avoids subtle platform adapter issues. Looks good.
9-18: No legacyclerkHandlerusage detectedI ran a repository-wide search for any remaining calls to
clerkHandler(and found no matches. All examples now consistently use the newhandlerFactorypattern.
15-18: Build Failure: Example’s Vite Config Missing Plugin
The build is failing due to a missing@tanstack/react-startVite plugin in the example’snode_modules, so we can’t verify the inline-nit change until the example successfully builds. Please ensure the example’s dependencies and Vite config are correct, then re-run:pnpm install pnpm -F tanstack-start-example-clerk-basic run buildOnce the build succeeds, you can optionally apply the one-liner inline:
-export default defineHandlerCallback(async (event) => { - const startHandler = await handlerFactory(defaultStreamHandler) - return startHandler(event) -}) +export default defineHandlerCallback(async (event) => (await handlerFactory(defaultStreamHandler))(event))
| }, | ||
| "dependencies": { | ||
| "@clerk/tanstack-react-start": "^0.19.0", | ||
| "@clerk/tanstack-react-start": "^0.23.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Version bump aligns with the new server handler pattern; verify peer deps.
The upgrade to @clerk/tanstack-react-start ^0.23.0 matches the server refactor in src/server.ts. Please verify that peer dependency ranges for React, @tanstack/react-start, and router packages are satisfied after the bump, and that the lockfile is updated.
Run from the repo root to surface any peer dep or type issues:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Check for unresolved peer deps and version mismatches
pnpm -w install
# Inspect the example app deps and hoisting results
pnpm -F tanstack-start-example-clerk-basic ls @clerk/tanstack-react-start @tanstack/react-start react react-dom
# Typecheck the example to ensure the new handler API is satisfied
pnpm -F tanstack-start-example-clerk-basic run buildLength of output: 3933
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Print the example's package.json to verify dependencies
sed -n '1,200p' examples/react/start-clerk-basic/package.json
echo "----"
# Print the example's Vite config to inspect imports
sed -n '1,200p' examples/react/start-clerk-basic/vite.config.tsLength of output: 1323
#!/bin/bash
set -euo pipefail
# Search for the Vite plugin entry in the react-start package source
echo "Searching for 'plugin/vite' references:"
rg -n "plugin/vite" -C2 packages/react-start
echo
# List files under the plugin directory, if it exists
echo "Listing plugin directory contents (if present):"
if [ -d "packages/react-start/plugin/vite" ]; then
find packages/react-start/plugin/vite -maxdepth 2 -type f -print
else
echo "packages/react-start/plugin/vite directory not found"
fi#!/usr/bin/env bash
set -euo pipefail
echo "Listing 'packages/react-start/plugin' directory:"
if [ -d "packages/react-start/plugin" ]; then
find packages/react-start/plugin -maxdepth 2 -type f -print
else
echo " packages/react-start/plugin directory not found"
fi
echo
echo "Searching for 'plugin/vite' references in packages/react-start:"
rg -n "plugin/vite" -C2 packages/react-start || echo " No 'plugin/vite' references found"
echo
echo "Searching for 'tanstackStart' export in packages/react-start:"
rg -n "export .*tanstackStart" -C3 packages/react-start || echo " No 'tanstackStart' export found"🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Directory structure under packages/react-start (depth=2):"
find packages/react-start -maxdepth 2 -type d
echo
echo "Contents of plugin/vite directory if it exists:"
if [ -d "packages/react-start/plugin/vite" ]; then
find packages/react-start/plugin/vite -maxdepth 2 -type f
else
echo "packages/react-start/plugin/vite not found"
fi
echo
echo "Searching for tanstackStart export in react-start sources:"
rg -n "export .*tanstackStart" -C3 packages/react-start || echo "No tanstackStart export found"Length of output: 754
Critical: Example build broken by invalid Vite plugin import
Peer dependencies (React ^19.0.0, @tanstack/react-start ^1.131.28, router packages ^1.131.28) are correctly satisfied and the lockfile is up-to-date, but the example fails to build due to a missing plugin entrypoint.
Please address the following before merging:
- examples/react/start-clerk-basic/vite.config.ts
The lineerrors at build time becauseimport { tanstackStart } from '@tanstack/react-start/plugin/vite'
@tanstack/react-startdoes not export aplugin/vitepath. - Verify and correct the Vite plugin entrypoint in the
@tanstack/react-startpackage (or adjust the import to the actual plugin location). - After fixing the import, confirm:
pnpm -w installcompletes with no unresolved peerspnpm -F tanstack-start-example-clerk-basic run buildsucceeds without errors
|
Some conflicts to be resolved |
Fixed |
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
See
Summary by CodeRabbit
Chores
Refactor