From 64085b2d0cf27863433b35c6fab0eeb12377da49 Mon Sep 17 00:00:00 2001 From: Kimaswa Emmanuel Yusufu <67486402+emmayusufu@users.noreply.github.com> Date: Fri, 12 Jun 2026 19:08:41 +0300 Subject: [PATCH] docs: fix broken code examples and wrong identifiers in guides (#46755) A handful of code samples in the guides either don't run or contradict the surrounding text. I found these reading through the docs. - `database/debugging-performance`: `insert into books` targets a table that's never created. The table made just above is `instruments`. - `database/drizzle`: the `db.ts` snippet references an undefined `host`. The variable in scope is `connectionString`. - `database/postgres/column-level-security`: the `create table` is missing a comma after `created_at ... now()`, so it won't parse. - `database/postgres/first-row-in-group`: `distinct on (team)` with `order by id, ...` is rejected by Postgres (the DISTINCT ON column has to lead the ORDER BY). Ordered by `team, points desc` so it returns one row per team. - `database/postgres/data-deletion`: reversed markdown link `(text)[url]`, plus "parititioning" misspelled. - `database/extensions/pg_plan_filter`: prose says `statement_cost_filter`, but the real parameter (used everywhere else in the file) is `statement_cost_limit`. - `auth/auth-hooks/mfa-verification-hook`: the insert and on-conflict update use `last_refreshed_at`, but the table column is `last_failed_at`. - `telemetry/advanced-log-filtering`: the "ends with" example writes `'$port=12345'`. The `$` anchor needs to come after the literal: `'port=12345$'`. - `ai/examples/headless-vector-search`: uses `${projectURL}` but the const is `projectUrl`. - `getting-started/quickstarts/redwoodjs`: prose says `scripts/seeds.ts`, but the code block and Redwood use `scripts/seed.ts`. - `getting-started/tutorials/with-flutter`: two code-fence headers have a stray trailing `"`. - `local-development/cli/testing-and-linting`: stray backtick in "Edge` Functions". ## Summary by CodeRabbit * **Documentation** * Corrected code examples across multiple guides including vector search, authentication hooks, database guides, and quickstarts * Fixed SQL syntax errors, variable names, and table references in example snippets * Resolved typos, broken links, and formatting inconsistencies in guide text * Clarified parameter names and script references in documentation * Updated code fence syntax in tutorials for proper rendering Co-authored-by: Chris Chinchilla --- .../content/guides/ai/examples/headless-vector-search.mdx | 2 +- .../guides/auth/auth-hooks/mfa-verification-hook.mdx | 4 ++-- .../docs/content/guides/database/debugging-performance.mdx | 2 +- apps/docs/content/guides/database/drizzle.mdx | 4 ++-- .../content/guides/database/extensions/pg_plan_filter.mdx | 2 +- .../guides/database/postgres/column-level-security.mdx | 2 +- .../content/guides/database/postgres/data-deletion.mdx | 2 +- .../guides/database/postgres/first-row-in-group.mdx | 7 +++---- .../guides/getting-started/quickstarts/redwoodjs.mdx | 2 +- .../guides/getting-started/tutorials/with-flutter.mdx | 4 ++-- .../guides/local-development/cli/testing-and-linting.mdx | 2 +- .../content/guides/telemetry/advanced-log-filtering.mdx | 2 +- 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/apps/docs/content/guides/ai/examples/headless-vector-search.mdx b/apps/docs/content/guides/ai/examples/headless-vector-search.mdx index fdf21d12cd5..b158bb4cd5f 100644 --- a/apps/docs/content/guides/ai/examples/headless-vector-search.mdx +++ b/apps/docs/content/guides/ai/examples/headless-vector-search.mdx @@ -84,7 +84,7 @@ const onSubmit = (e: Event) => { const query = new URLSearchParams({ query: inputRef.current!.value }) const projectUrl = `https://your-project-ref.supabase.co/functions/v1` - const queryURL = `${projectURL}/${query}` + const queryURL = `${projectUrl}/${query}` const eventSource = new EventSource(queryURL) eventSource.addEventListener("error", (err) => { diff --git a/apps/docs/content/guides/auth/auth-hooks/mfa-verification-hook.mdx b/apps/docs/content/guides/auth/auth-hooks/mfa-verification-hook.mdx index bbaf4cc924b..6e46c37860a 100644 --- a/apps/docs/content/guides/auth/auth-hooks/mfa-verification-hook.mdx +++ b/apps/docs/content/guides/auth/auth-hooks/mfa-verification-hook.mdx @@ -142,7 +142,7 @@ as $$ ( user_id, factor_id, - last_refreshed_at + last_failed_at ) values ( @@ -151,7 +151,7 @@ as $$ now() ) on conflict do update - set last_refreshed_at = now(); + set last_failed_at = now(); -- finally let Supabase Auth do the default behavior for a failed attempt return jsonb_build_object('decision', 'continue'); diff --git a/apps/docs/content/guides/database/debugging-performance.mdx b/apps/docs/content/guides/database/debugging-performance.mdx index a2f349d7547..f333c94bb56 100644 --- a/apps/docs/content/guides/database/debugging-performance.mdx +++ b/apps/docs/content/guides/database/debugging-performance.mdx @@ -44,7 +44,7 @@ create table instruments ( name text ); -insert into books +insert into instruments (id, name) values (1, 'violin'), diff --git a/apps/docs/content/guides/database/drizzle.mdx b/apps/docs/content/guides/database/drizzle.mdx index 88a02df030e..852e0d356f4 100644 --- a/apps/docs/content/guides/database/drizzle.mdx +++ b/apps/docs/content/guides/database/drizzle.mdx @@ -81,8 +81,8 @@ If you plan on solely using Drizzle instead of the Supabase Data API (PostgREST) import postgres from 'postgres' let connectionString = process.env.DATABASE_URL - if (host.includes('postgres:postgres@supabase_db_')) { - const url = URL.parse(host)! + if (connectionString.includes('postgres:postgres@supabase_db_')) { + const url = URL.parse(connectionString)! url.hostname = url.hostname.split('_')[1] connectionString = url.href } diff --git a/apps/docs/content/guides/database/extensions/pg_plan_filter.mdx b/apps/docs/content/guides/database/extensions/pg_plan_filter.mdx index 17e8782a234..291f9c73a6f 100644 --- a/apps/docs/content/guides/database/extensions/pg_plan_filter.mdx +++ b/apps/docs/content/guides/database/extensions/pg_plan_filter.mdx @@ -52,7 +52,7 @@ explain select * from book; (1 row) ``` -Now we can choose a `statement_cost_filter` value between the total cost for the single select (2.49) and the whole table select (135.0) so one statement will succeed and one will fail. +Now we can choose a `statement_cost_limit` value between the total cost for the single select (2.49) and the whole table select (135.0) so one statement will succeed and one will fail. {/* prettier-ignore */} ```sql diff --git a/apps/docs/content/guides/database/postgres/column-level-security.mdx b/apps/docs/content/guides/database/postgres/column-level-security.mdx index 4c4e6ffb12f..d1e3ebbdb93 100644 --- a/apps/docs/content/guides/database/postgres/column-level-security.mdx +++ b/apps/docs/content/guides/database/postgres/column-level-security.mdx @@ -134,7 +134,7 @@ supabase migration new create_posts_table user_id text, title text, content text, - created_at timestamptz default now() + created_at timestamptz default now(), updated_at timestamptz default now() ); diff --git a/apps/docs/content/guides/database/postgres/data-deletion.mdx b/apps/docs/content/guides/database/postgres/data-deletion.mdx index a8a0941bbdd..a27ac37074c 100644 --- a/apps/docs/content/guides/database/postgres/data-deletion.mdx +++ b/apps/docs/content/guides/database/postgres/data-deletion.mdx @@ -66,7 +66,7 @@ WHERE id IN ( This approach has the benefit of controlling when it runs, locking for a shorter period of time and minimising impact on other transactions. -If you know in advance that such large deletes will have to happen in the business cycle of your database, then you should seriously think about using (table parititioning)[/docs/guides/database/partitions] as a management tool. +If you know in advance that such large deletes will have to happen in the business cycle of your database, then you should seriously think about using [table partitioning](/docs/guides/database/partitions) as a management tool. ### Soft deletes diff --git a/apps/docs/content/guides/database/postgres/first-row-in-group.mdx b/apps/docs/content/guides/database/postgres/first-row-in-group.mdx index f94891a5c4a..b20a3eaa8b8 100644 --- a/apps/docs/content/guides/database/postgres/first-row-in-group.mdx +++ b/apps/docs/content/guides/database/postgres/first-row-in-group.mdx @@ -32,10 +32,9 @@ select distinct points from seasons -order BY - id, - points desc, - team; +order by + team, + points desc; ``` The important bits here are: diff --git a/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx b/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx index 7f6a4f66a68..3e8a6c42fc3 100644 --- a/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx +++ b/apps/docs/content/guides/getting-started/quickstarts/redwoodjs.mdx @@ -145,7 +145,7 @@ hideToc: true Let's seed the database with a few instruments. - Update the file `scripts/seeds.ts` to contain the following code: + Update the file `scripts/seed.ts` to contain the following code: diff --git a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx index 257064c7481..9c345a4d4dd 100644 --- a/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx +++ b/apps/docs/content/guides/getting-started/tutorials/with-flutter.mdx @@ -67,7 +67,7 @@ Add `CFBundleURLTypes` to enable deep linking: <$CodeTabs> -```xml name=ios/Runner/Info.plist" +```xml name=ios/Runner/Info.plist @@ -314,7 +314,7 @@ Let's create a new widget called `account_page.dart` for that. <$CodeTabs> -```dart name=lib/pages/account_page.dart" +```dart name=lib/pages/account_page.dart import 'package:flutter/material.dart'; import 'package:supabase_flutter/supabase_flutter.dart'; import 'package:supabase_quickstart/main.dart'; diff --git a/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx b/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx index 5246f956484..017961afb7c 100644 --- a/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx +++ b/apps/docs/content/guides/local-development/cli/testing-and-linting.mdx @@ -5,7 +5,7 @@ description: 'Using the CLI to test your Supabase project.' subtitle: 'Using the CLI to test your Supabase project.' --- -The Supabase CLI provides a set of tools to help you test and lint your Postgres database and Edge` Functions. +The Supabase CLI provides a set of tools to help you test and lint your Postgres database and Edge Functions. ## Testing your database diff --git a/apps/docs/content/guides/telemetry/advanced-log-filtering.mdx b/apps/docs/content/guides/telemetry/advanced-log-filtering.mdx index 36dbb69b60c..9b591e483af 100644 --- a/apps/docs/content/guides/telemetry/advanced-log-filtering.mdx +++ b/apps/docs/content/guides/telemetry/advanced-log-filtering.mdx @@ -184,7 +184,7 @@ regexp_contains(event_message, '^connection') ```sql -- find only messages that ends with port=12345 -regexp_contains(event_message, '$port=12345') +regexp_contains(event_message, 'port=12345$') ``` ### Ignore case sensitivity: