mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem Studio's `routes/api/platform/auth/**` and platform misc/stub routes still run legacy Next Pages Router handlers through `compat/next/api.ts`, and 4 legacy database/props routes have no callers left. Part 4 of 7 for [FE-5114](https://linear.app/supabase/issue/FE-5114/rewrite-api-routes-as-native-tanstack-start-handlers-and-remove-the) migrates the 16 active routes to native TanStack Start handlers and removes the 4 unused ones. ## Solution **Changed:** - Migrated `platform/auth/$ref/{invite,magiclink,otp,recover}` to one-line `createAuthSenderHandlers` routes, and `users/index`, `users/$id/index`, and `users/$id/factors` to `createApiHandlers`, preserving the FE-5124 fixes (`Promise.all` MFA factor deletion, `code ?? 500` on auth senders, `Allow: PATCH, DELETE` on `users/$id`, now derived by `createApiHandlers`) - Migrated 9 platform misc/stub routes (`deployment-mode`, `integrations/{$slug,github/*}`, `organizations/{index,$slug/billing/subscription}`, `profile/index`, and `telemetry/event`) - Moved the `FETCH_TYPE_BYPASS_EXCEPTIONS` entries for the four sender routes in `eslint.config.cjs` to `lib/api/self-hosted/auth-senders.ts` **Added:** - `createAuthSenderHandlers(endpoint, field)` in `lib/api/self-hosted/auth-senders.ts`: shared POST handler for the self-hosted GoTrue `invite`, `magiclink`, `otp`, and `recover` endpoints (forwards only `email` or `phone`, uses `constructHeaders` with the service role key, and passes upstream errors through with `code ?? 500`) - Regression tests for `auth/$ref/users/$id/factors`, `auth/$ref/users/$id`, and all four auth sender routes **Removed:** - Removed 4 unused routes (`platform/database/$ref/pooling`, `platform/props/org/$slug`, `platform/props/project/$ref/index`, and `platform/props/project/$ref/api`) and regenerated `routeTree.gen.ts` ## Review instructions 1. Run `pnpm --filter studio exec vitest run tests/routes/api/platform/auth/`. 2. On self-hosted Studio, invite/ban/delete a user, remove MFA factors for a user, and confirm `GET /api/platform/auth/default/users/<id>` returns `405` with `Allow: PATCH, DELETE`. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [ ] If I wrote a new docs topic or edited an existing topic, I used the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs [style guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide) --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>