chore: remove Clerk - #27
Merged
Merged
Conversation
Auth.js has been the only working sign-in path since the migration landed; Clerk was still installed, still registered as a Convex auth provider, and still had a live webhook endpoint that could write to the users table. This removes all of it. Gone: - @clerk/nextjs and svix as dependencies - convex/http.ts's /clerk-webhook route (179 lines) and its signature verification, along with syncUser/syncUserFromWebhook in convex/users.ts that it called - Clerk's provider entry in convex/auth.config.ts, so a Clerk token is now rejected rather than accepted-but-unused - ConvexClerkProvider, UserSyncStatusProvider, useSyncUser, useClerkAppearance and clerkAppearance, none of which were rendered any more - every CLERK_* variable from .env.example, docker-compose.yml, the Dockerfile build args, both workflows, src/lib/env.ts and the health endpoint convex/lib/subjectResolution.ts drops to a single db.get. The by_clerk_id and by_legacy_clerk_id fallbacks existed because a token could arrive from either provider mid-migration; with one provider registered, a subject can only be a Convex document id, so those reads could only ever miss. users.clerkId is deliberately kept. It stopped being an authentication identifier here, but it is the internal user id that interviews.candidateId, interviews.interviewerIds and auditLogs.actorClerkId hold as plain v.string() across hundreds of call sites. Dropping the column would orphan the participants of every interview, so renaming it is a data migration of its own and needs the production backfill to have run first. README.md's setup and pre-launch sections now describe Auth.js, including the AUTH_URL empty-string trap that took production down, and CLAUDE.md's identity table no longer describes resolution logic that has been deleted. Verified: typecheck clean, 265/265 tests pass, production build succeeds.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auth.js has been the only working sign-in path since the migration landed. Clerk was still installed, still registered as a Convex auth provider, and still had a live webhook endpoint that could write to the
userstable. This removes all of it.What's gone
@clerk/nextjsandsvixas dependenciesconvex/http.ts's/clerk-webhookroute (179 lines) and its signature verification, plussyncUser/syncUserFromWebhookinconvex/users.tsthat only it called.http.tsis down to the one remaining route,/internal/backup-record.convex/auth.config.ts, so a Clerk token is now rejected rather than accepted-but-unusedConvexClerkProvider,UserSyncStatusProvider,useSyncUser,useClerkAppearance,clerkAppearance— none of them rendered any moreCLERK_*variable from.env.example,docker-compose.yml, theDockerfilebuild args, both workflows,src/lib/env.tsand/api/healthconvex/lib/subjectResolution.tsdrops to a singledb.getThe
by_clerk_idandby_legacy_clerk_idfallbacks existed because a token could arrive from either provider mid-migration. With one provider registered, a subject can only be a Convex document id — those reads could only ever miss.normalizeIdstill guards the lookup so a malformed subject resolves to "no such user" rather than a 500.users.clerkIdis deliberately keptWorth being explicit about, since "remove Clerk completely" would suggest otherwise.
It stopped being an authentication identifier here — nothing verifies a token against it any more. But it is the internal user id that
interviews.candidateId,interviews.interviewerIdsandauditLogs.actorClerkIdhold as a plainv.string(), across hundreds of call sites in 30 files. Dropping the column would orphan the participants of every interview.Renaming it is a data migration of its own, and it additionally needs
migrations/authBackfill:runto have run against production first. Tracked separately.Docs
README.md's setup and pre-launch sections now describe Auth.js instead of Clerk, including theAUTH_URLempty-string trap that took production down —@auth/coreuses??, so an empty value disablestrustHostand is strictly worse than an absent one.CLAUDE.md's identity table no longer describes resolution logic that has been deleted.Verification
npm run typecheck— cleannpm run test— 265/265 passnpm run build— succeedsNote for after merge
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEYandCLERK_WEBHOOK_SECRETare no longer read by anything, so the GitHub Actions secrets and the Portainer stack entries can be deleted whenever convenient. Leaving them set is harmless.