mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem The User Management guide shows a trigger that copies new users into `public.profiles`, but it doesn't say why the function sets `search_path = ''` and writes `public.profiles` in full. A reader who drops the schema from a table name breaks every sign-up, and the page doesn't connect that to the `Database error saving new user` response. Related to [FDBKIN-40810](https://linear.app/supabase/issue/FDBKIN-40810/document-best-practices-for-security-definer-triggers-on-authusers) Closes [DOCS-1715](https://linear.app/supabase/issue/DOCS-1715/explain-why-the-signup-trigger-must-schema-qualify-tables) ## Solution A caution admonition right after the trigger example on `/guides/auth/managing-user-data` tells readers to schema-qualify every non-built-in name in the function, such as `public.profiles`. It explains that the function sets `search_path = ''`, so Postgres can't find an unqualified name, the trigger fails, and every sign-up fails with `Database error saving new user`. The note leaves out the Auth role's own search path, because it doesn't apply once the function sets an empty one. For why the search path stays empty, it links to the "Security `definer` vs `invoker`" section of the database functions guide instead of repeating it. The SQL example and the rest of the page are unchanged. ## How to verify 1. On the preview, open `/docs/guides/auth/managing-user-data`. 2. Right after the `handle_new_user` / `on_auth_user_created` SQL example, a caution note says to schema-qualify names such as `public.profiles`, says the function's `search_path = ''` is why an unqualified name fails, and gives the `Database error saving new user` error. 3. The note's link opens the "Security `definer` vs `invoker`" section of `/docs/guides/database/functions`. 4. No other text on the page changed. ## Checks Ran `pnpm turbo run typecheck --filter='...[origin/master]'`, `pnpm turbo run lint --filter='[origin/master]'` (0 errors), and Prettier `--check` on the changed file. The error string was checked against `supabase/auth` `internal/api/signup.go` (`signupNewUser` returns `Database error saving new user` when the user insert fails). The docs tests were skipped because they need Docker. A second reader reviewed the change against the style guide. ## Checklist - [x] I have read [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) - [x] 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: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Supabase Docs
This directory contains the Next.js app for supabase.com/docs.
Guides live in content/ as MDX. Reference pages are generated from the specs in spec/: OpenAPI, SDKSpec, ConfigSpec, and CLISpec. Some sections come from other repositories.
Where to go
- To write a page, follow the style guide.
- To find where a page lives, add one, or update generated reference docs, use the contributing guide. Library maintainers start at Reference structure.
- To use an agent, use the AI agent skills for docs authoring. Those skills include framing a page and placing it in the information architecture.
- To run the site locally, use the developers' guide.
- To add or change a redirect, read
lib/redirects/README.mdfirst.