Commit Graph
13 Commits
Author SHA1 Message Date
JerryandNik Richers f1e56e127f fix(docs): broadcast Realtime DELETE events to the record topic (#53579)
Closes #53584

## Problem

Two Realtime guides attach `realtime.broadcast_changes` triggers that
fire on `DELETE`:

- `apps/docs/content/guides/realtime/broadcast.mdx` —
`your_table_changes`, used by a trigger declared `AFTER INSERT OR UPDATE
OR DELETE`
- `apps/docs/content/guides/realtime/getting_started.mdx` —
`broadcast_message_changes`, used by a trigger declared `AFTER INSERT OR
UPDATE OR DELETE`

Both build the broadcast topic from the new row only:

```sql
'topic:' || NEW.id::text
'room:' || NEW.room_id::text || ':messages'
```

On `DELETE`, `NEW` is `NULL`, so the concatenation produces a `NULL`
topic. `realtime.broadcast_changes` passes that to `realtime.send`,
which inserts into `realtime.messages`. In `supabase/realtime`,
`realtime.messages.topic` is `text not null`, and `realtime.send` wraps
its insert in an exception handler that downgrades the failure to a
warning:

```sql
EXCEPTION WHEN OTHERS THEN
  RAISE WARNING 'WarnSendingBroadcastMessage: %', SQLERRM;
```

So the trigger succeeds, logs only a warning, and no `DELETE` message
reaches subscribers. The sibling guide already handles this correctly:
`subscribing-to-database-changes.mdx` uses `coalesce(NEW.id, OLD.id)`.

## Fix

Use `coalesce(NEW.id, OLD.id)` in `broadcast.mdx` and
`coalesce(NEW.room_id, OLD.room_id)` in `getting_started.mdx`, matching
`subscribing-to-database-changes.mdx` so all three guides teach the same
pattern.

The `realtime.send` example in `getting_started.mdx` is unchanged
because its trigger is `AFTER INSERT` only, where `NEW` is always
present.

One caveat: `coalesce` falls back to `OLD` whenever `NEW` is null,
including an `UPDATE` that clears a nullable `room_id`. That broadcasts
to the former room, where the `CASE` form would emit a null topic and
send nothing. The example reads as if a message always belongs to a
room; for a schema where `room_id` can be cleared, use `CASE WHEN TG_OP
= 'DELETE' THEN OLD.room_id ELSE NEW.room_id END`.

## Verification

I tested the exact edited SQL blocks against
`supabase/postgres:17.6.1.143`, using the real
`realtime.broadcast_changes` and `realtime.send` definitions from
`supabase/realtime` and a `realtime.messages` table that keeps the
production `topic text not null` constraint.

Before the fix, running `INSERT`, `UPDATE`, then `DELETE` on the
`getting_started.mdx` snippet:

```text
WARNING:  WarnSendingBroadcastMessage: syntax error at or near "NULL"
 event  |      topic      |   op
--------+-----------------+--------
 INSERT | room:7:messages | INSERT
 UPDATE | room:7:messages | UPDATE
(2 rows)
```

After the fix, running insert, update body, update `room_id` to `NULL`,
move to room 9, then delete:

```text
 event  |      topic      |   op   | new_room | old_room
--------+-----------------+--------+----------+----------
 INSERT | room:7:messages | INSERT | 7        |
 UPDATE | room:7:messages | UPDATE | 7        | 7
 UPDATE | room:7:messages | UPDATE |          | 7
 UPDATE | room:9:messages | UPDATE | 9        |
 DELETE | room:9:messages | DELETE |          | 9
(5 rows)
```

The `room_id` to `NULL` update follows the caveat above; `INSERT`, a
normal `UPDATE`, a room move, and `DELETE` all use the expected topic.
The `broadcast.mdx` snippet produces `INSERT`/`UPDATE`/`DELETE` messages
with `topic:<id>`.

Prettier passes on both files.

## Authorship and review

This PR is written by me. AI assisted with drafting and with setting up
the test harness, but I reviewed and audited every change myself and I
stand behind it.

## 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: Nik Richers <nrichers@gmail.com>
2026-11-22 14:35:06 -07:00
Kody JacksonandClaude Sonnet 5.5 8d6d27ae4a docs: add cross-links in guides (getting started, platform, storage, and others) (#53561)
Adds internal cross-links to docs guides

## Testing

- Prettier passes on the changed lines.
- Docs build passes (`pnpm build --filter=docs`).
- Docs link e2e run locally against the production build for every
changed page across this PR.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 08:56:46 -06:00
Kody JacksonandClaude Sonnet 5.5 701730e3eb chore(kb,www,docs) - Add in relevant cross-links between the Supabase Component Library and kb,www,docs (#53237)
## Problem

After #53183 and #52567 have been addressed, we should strengthen the
interconnections between the UI library and the rest of the Supabase
ecosystem.

## Solution

- Adds contextual links for `/library`, Auth / Realtime category pages,
and specific Auth / Realtime components. Hits top-level product pages,
docs, kb, and blogs.

## Preview links

N/A, link changes are relatively atomic so easier to review without many
preview links.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-11 08:37:14 -06:00
Miranda Limonczenko 1d50816f47 docs: enforce duplicate ID a11y rules and fix duplicates (#52720)
Closes DOCS-1573

## Problem

Recently, @antlio surfaced that our side nav was visually breaking. This
is caused by a duplicate-id issue.

The docs E2E axe scan reports duplicate `id` attributes as a warning
only, so pages with duplicate IDs ship. A full scan of production guides
found duplicate IDs on 25 of 586 pages.

**Causes:**

- **Repeated headings:** a page uses the same heading text twice, for
example `#### Example` under two sections. Each heading slugs to the
same ID.
- **Pricing partials:** three usage pages put `## Pricing` directly
above a shared partial that starts with its own Pricing heading.
- **Components:** Mermaid diagrams hardcode SVG marker and node IDs. The
Apple secret generator renders `id="undefined-optional"` on each field
label. Each "Build it" listing on the Supabase way page renders
`#build-it`.

## Solution

- **Enforce the rules:** add `duplicate-id`, `duplicate-id-active`, and
`duplicate-id-aria` to `ENFORCED_RULES`.
- **Repeated headings:** give each later duplicate a
`[#parent-section-heading]` anchor. The first occurrence keeps its ID.
- **Pricing headings:** remove the page heading above the three partials
that start with `## Pricing`. The PITR partial starts with `###
Pricing`, so it gets `[#pitr-pricing]` and the page keeps its H2.
- **Mermaid:** prefix the SVG IDs of each diagram with `useId()`.
- **Apple secret generator:** give each field an ID. The label now also
points at its input.
- **Content listings:** add an optional `headingAnchor` to listing
groups, and set it on the repeated "Build it" groups.
- **pg_net:** the `http_delete` signature had `[#post-signature]`,
copied from `http_post`. It is now `[#delete-signature]`.

**Cross-references:** no link in the repo targets a changed ID. Each
first occurrence keeps its ID, so existing links resolve to the same
heading as before.

**Not changed:** the www suite and `packages/ui-patterns`. All fixes
stay in `apps/docs`.

**Verification:**

- Against production,
`/docs/guides/platform/manage-your-usage/log-drains` fails the @a11y
test with `duplicate-id`.
- Against a local docs server, the @a11y test passes on all 28 changed
or affected pages.

**Unverified:** a full-site run with `A11Y_ENFORCE_ALL=1`. Run it
against the preview before merge.

## Review instructions

1. From `e2e/docs`, run the a11y test against production. See it fail
with `duplicate-id`:

   ```bash
DOCS_E2E_PAGE_PATHS=/docs/guides/platform/manage-your-usage/log-drains
PLAYWRIGHT_BASE_URL=https://supabase.com pnpm exec playwright test
--grep @a11y
   ```

2. Run the same command with `PLAYWRIGHT_BASE_URL` set to the docs
preview URL from the Vercel bot comment. See it pass.
3. On the preview, open
`/docs/guides/platform/manage-your-usage/log-drains`. In the table of
contents, select **Pricing** under **Log Drain Events**. See the page
scroll to the second Pricing section.
4. On the preview, open
`/docs/guides/integrations/partner-integration-guide`. See both sequence
diagrams render with arrowheads.

## Checklist

Check all before review:

- [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)
2026-11-03 11:56:33 -08:00
Kody JacksonandCodesmith 2d7e5f57ed chore(docs / www) - update video links to latest DevRel videos where applicable (#51606)
## Problem

Several outdated (or missing) video references across docs and www apps.

## Solution

Updates these links (and adds where appropriate) to link out to the
newer series on Supabase by @dshukertjr and individual videos by
@dijonmusters

## Preview links


[docs](https://docs-git-kody-devrel-708-update-video-links-supabase.vercel.app/docs)

[www](https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/)

## Review instructions

For marketing folks specifically, sanity check on the
[changes](https://github.com/supabase/supabase/pull/51606/changes#diff-1fb413a22e16c9b7b200e47aa9661c8be240a52a06276ed04c450e3d92c9a12a)
to the features.tsx file, which render to:



Page | Before (live) | After (preview)
-- | -- | --
vector-database | https://supabase.com/features/vector-database |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/vector-database
realtime-postgres-changes |
https://supabase.com/features/realtime-postgres-changes |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/realtime-postgres-changes
realtime-broadcast | https://supabase.com/features/realtime-broadcast |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/realtime-broadcast
realtime-presence | https://supabase.com/features/realtime-presence |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/realtime-presence
deno-edge-functions | https://supabase.com/features/deno-edge-functions
|
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/deno-edge-functions
cli | https://supabase.com/features/cli |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/cli
role-based-access-control |
https://supabase.com/features/role-based-access-control |
https://zone-www-dot-com-git-kody-devrel-708-update-vid-8e2d6a-supabase.vercel.app/features/role-based-access-control

---------

Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
2026-10-14 08:27:19 -05:00
Guillaume Faas 94bc3f8d07 docs(csharp): add C# snippets (#48537)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Added C# examples across API, authentication, database, Realtime, and
Storage guides.
* Expanded authentication coverage for passwordless, phone, anonymous,
identity linking, SSO, sign-out, and social login providers.
* Added database examples for queries, functions, joins, JSON, arrays,
search, PostGIS, and custom schemas.
* Added Realtime examples for broadcasts, presence, subscriptions, and
database changes.
* Added Storage examples for buckets, uploads, downloads,
transformations, CDN purging, and resumable transfers.
  * Included C# error-handling guidance and relevant reference links.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-08-03 13:13:55 +02:00
b847c8dd69 docs: Key updates for realtime (#45130)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Rewrote realtime guides to recommend new publishable and secret API
keys instead of legacy key guidance.
* Updated code examples (TypeScript, Flutter, Swift, Python, Dart) to
use publishable key naming.
* Simplified REST examples by removing the service-role Authorization
header and standardizing the apikey header to use a secret key.
* Improved Dashboard/API Keys navigation links and added connect dialog
query parameters.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: fadymak <dev@fadymak.com>
Co-authored-by: fadymak <fady@fadymak.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-04-27 11:20:50 +02:00
tonjoandChris Chinchilla a760a9cc96 docs: Fix syntax for channel creation in Python example (#39212)
Wrong Python syntax fixed

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
2026-01-12 10:00:21 +00:00
Kevin Grüneberg 140e74435d docs: rename Realtime quotas to Limits (#41816)
We use the quota term for actual billing quotas, so using "Quota" as a term for configurable Realtime limits is confusing. While there are varying per-plan limits, they are not used for billing. Realtime Quotas on plans refer to Realtime Messages and Realtime Peak Connections
2026-01-12 16:03:25 +07:00
Sebastien Chapuis 86f4bea83d docs: Fix documentation for realtime.send call (#39839)
The json payload is the first parameter:
https://github.com/supabase/realtime/blob/5290aa117baabcd9d8c324e6c22574c348d35295/lib/realtime/tenants/repo/migrations/20250714121412_broadcast_send_error_logging.ex#L7
2026-01-12 04:56:05 +00:00
VaibhavandChris Chinchilla c5d9003c98 fix(docs): add missing variables to api_settings partial in getting_started (#41389)
* fix(docs): add missing variables to api_settings partial in realtime getting_started

* Update apps/docs/content/guides/realtime/getting_started.mdx

---------

Co-authored-by: Chris Chinchilla <chris@chrischinchilla.com>
2025-12-16 13:34:49 +01:00
Chris ChinchillaandCharis Lam 9795b76431 docs: Add further toggles to content (#38870)
* Implement futher changes for Nimbus

* fixes

---------

Co-authored-by: Charis Lam <26616127+charislam@users.noreply.github.com>
2025-09-19 16:53:20 +00:00
Filipe Cabaçoandgithub-actions[bot] 2b3abd79f5 realtime: improve getting started guide (#38562)
---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-09-17 14:31:58 +01:00