Skip to content

(wip) (supabase) add guide on supporting orgs with supabase integration - #2187

Closed
alexisintech wants to merge 8 commits into
mainfrom
aa/DOCS-10212
Closed

(wip) (supabase) add guide on supporting orgs with supabase integration#2187
alexisintech wants to merge 8 commits into
mainfrom
aa/DOCS-10212

Conversation

@alexisintech

@alexisintech alexisintech commented Apr 15, 2025

Copy link
Copy Markdown
Contributor

🔎 Previews:

What does this solve?

What changed?

Checklist

  • I have clicked on "Files changed" and performed a thorough self-review
  • All existing checks pass

@github-actions

Copy link
Copy Markdown
Contributor

Hey, here’s your docs preview: https://clerk.com/docs/pr/2187

@alexisintech alexisintech changed the title (wip) supabase + orgs (wip) add guide on supporting orgs with supabase integration Apr 15, 2025
@alexisintech alexisintech changed the title (wip) add guide on supporting orgs with supabase integration (wip) (supabase) add guide on supporting orgs with supabase integration Apr 15, 2025
@manovotny manovotny self-assigned this Jul 16, 2026
@manovotny

Copy link
Copy Markdown
Contributor

Closing this. The gap it targets is still real — the Supabase integration guide doesn't mention organizations anywhere across its 356 lines — but this branch isn't the fastest way there.

Two things. supabase/config.toml and supabase/.gitignore came along by accident, so 316 of the 495 added lines are a local Supabase scaffold rather than docs.

The bigger one is that the RLS policies don't work as written. auth.jwt()->>'o.id' looks for a top-level claim literally named o.id, but the org ID is nested — the JWT example on this page shows o: { id: 'org_123' }. So that expression is always NULL: auth.jwt()->>'o.id' is null is always true, = org_id never matches, and the new column's default is always NULL. Org support quietly does nothing. The TODO in the test section, about non-org tasks possibly still being visible, is that bug showing up.

The blog post this was meant to be based on already has the correct form, and a cleaner shape — one owner_id column and a helper function instead of two columns and a four-clause OR:

create or replace function requesting_owner_id()
returns text language sql stable as $$
  select coalesce(
    (auth.jwt() -> 'o'::text) ->> 'id'::text,
    (auth.jwt() ->> 'sub'::text)
  );
$$;

DOCS-10212 stays open and now carries a note recording the ->>'o.id' trap so it doesn't get rediscovered. Starting fresh from the blog post should be quicker than untangling this branch, which would also need every internal link repointed after the docs restructure.

@manovotny manovotny closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants