Commit Graph
10 Commits
Author SHA1 Message Date
supabase-vercel-tedd[bot]andalexisintech ac87f00328 docs(functions): explain how a local function reaches the local stack and host services (#54557)
## Problem

When a function runs locally with `supabase start` or `supabase
functions serve`, calls to `localhost` or `127.0.0.1` inside it fail
with "Connection refused". The Edge Functions development environment
page didn't say that the function runs in a Docker container, or how to
reach the local Supabase services and servers on the reader's machine.

Related to
[FDBKIN-6695](https://linear.app/supabase/issue/FDBKIN-6695/document-how-local-edge-functions-can-call-services-on-the-host)
Closes
[DOCS-1853](https://linear.app/supabase/issue/DOCS-1853/explain-how-a-local-edge-function-reaches-the-local-stack-and-services)

## Solution

Adds a "Reach other services from a local function" section to the Edge
Functions development environment page. It explains that `localhost`
inside a local function means the container, points to `SUPABASE_URL`
(and `SUPABASE_DB_URL`) for the local Supabase services, and shows
`host.docker.internal:<port>` for a server on the host, including the
Linux requirement to listen on `0.0.0.0`. Under `supabase start`,
`SUPABASE_DB_URL` uses a `supabase_db_` host that some clients, such as
Postgres.js, can't resolve, so the section says to swap that host for
`db`. A one-line `.env` example keeps the host URL in a local secret, so
deployed code uses a production secret instead. It also drops the claim
under `supabase start` that local development is the exact same
environment as production, which the new section contradicts.

The Postgres tab note on the CLI getting-started page told readers to
reach the database from a function through `host.docker.internal`. It
now says a local function can't reach the database at that URL, and
links to the new section, so both pages give the same advice.

On the Drizzle page, the garbled note in the "Connect" step now says the
`db.ts` sample swaps the `supabase_db_` host for `db` in a local Edge
Function, and links to the new section. The same step now links the
**Connect** panel straight to the **Transaction pooler** URI, since the
panel has no "Shared pooler" option. The `db.ts` comment now says
`prepare: false` disables prepared statements, not prefetch. The page
gets a task title and a description that say what it helps the reader
do. Smaller fixes: the password instruction is plainer, "connection
pooler" is lowercase, a double space is gone, and "Related resources" is
in sentence case.

The Prisma and Postgres.js quickstarts had the same bare title and
"Quickstart" description, so they get task titles and descriptions too,
and the three ORM quickstarts now match. The Postgres.js page uses
"Query" rather than "Connect to", because "Connect to Postgres with
Postgres.js" is over the style guide's 35-character title limit.

## How to verify

1. Open
https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/functions/development-environment#reach-other-services-from-a-local-function,
https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/local-development/cli/getting-started
(the **Postgres** tab under "Access your project's services"),
https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/drizzle
(step 3, "Connect"),
https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/prisma,
and
https://docs-git-tedd-docs-1853-supabase.vercel.app/docs/guides/database/postgres-js.
2. The section states that a locally served function runs in a Docker
container, so `localhost` and `127.0.0.1` in function code mean the
container.
3. Under "Reach the local Supabase services", the section says to use
`SUPABASE_URL` for the local Supabase services, notes it is
`http://kong:8000` locally, and links to the default secrets table on
the secrets page. It says to swap a `supabase_db_` host in
`SUPABASE_DB_URL` for `db` for clients that can't resolve it.
4. The section says to reach a server on the host through
`host.docker.internal:<port>`, and that on Linux the server must listen
on `0.0.0.0`.
5. The example sets `API_URL` in `supabase/functions/.env`. The local
secrets and production secrets links open the matching sections of the
secrets page.
6. The `supabase start` paragraph no longer claims the local environment
is identical to production.
7. The getting-started Postgres tab note no longer mentions
`host.docker.internal`, and its link opens the "Reach the local Supabase
services" section.
8. On the Drizzle page, step 3 says the `db.ts` sample swaps the
`supabase_db_` host for `db` in a local Edge Function, and links to
"Reach the local Supabase services". The **Connect** panel link opens
the **Direct** tab with **Transaction pooler** selected. The `db.ts`
comment mentions prepared statements, and the last heading reads
"Related resources".
9. The Drizzle page's title reads "Connect to Postgres with Drizzle",
the Prisma page's reads "Connect to Postgres with Prisma", and the
Postgres.js page's reads "Query Postgres with Postgres.js". The sidebar
keeps its existing labels for all three.

## Checks

Ran `pnpm exec oxfmt --check` on the changed files. Typechecked the
snippet with `tsc --strict` (with a `Deno` declaration); it was also run
with `deno check`, `deno lint`, and served with `supabase functions
serve` on Linux, where `localhost` and a `127.0.0.1`-bound host server
were refused and `host.docker.internal` to a `0.0.0.0`-bound server
returned 200. Under `supabase start`, Postgres.js failed to resolve the
`supabase_db_` host in `SUPABASE_DB_URL` and connected with the host set
to `db`, and `localhost:54322` from a function was refused. The Drizzle
`db.ts` host check was run under `supabase start` with a project ID that
contains an underscore: it rewrote the host to `db` and a Drizzle query
succeeded. Checked `SUPABASE_URL=http://kong:8000`, `SUPABASE_DB_URL`,
and the Linux `host.docker.internal:host-gateway` mapping against
`supabase/cli` (`apps/cli/src/shared/functions/serve.ts`,
`apps/cli/src/commands/start/start.handler.ts`,
`apps/cli/src/commands/start/services/edge-runtime.service.ts`). Checked
the **Connect** panel labels and its `connectTab` and `method` query
parameters against `apps/studio/components/interfaces/ConnectSheet`, and
`prepare: false` against the Postgres.js source. The ORM quickstart
titles and descriptions follow the style guide's length limits, and each
description matches its page's steps. The navigation sets its own
labels, and no nav entry, breadcrumb, or test reads the old titles.
ESLint ignores MDX files, and the docs build was not run in the sandbox.

## Follow-ups

- `apps/docs/content/guides/database/drizzle.mdx`: the `db.ts` sample is
written for Node (`import 'dotenv/config'`, `process.env.DATABASE_URL`),
but its `supabase_db_` host check only applies inside a Deno Edge
Function under `supabase start`. A reader in either runtime gets a
sample that half fits.
- `apps/docs/content/guides/database/drizzle.mdx`: the page has no value
statement and no next steps. It opens straight into the gerund heading
"Connecting with Drizzle" and ends after the connection step. Step 1
installs `drizzle-kit`, but no step uses it, so the reader can't create
the `users` table from `schema.ts`.

## Checklist

- [x] I have read the [Contributing
Guidelines](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [ ] I have checked that the change works in the preview deployment

## Feedback for Tedd

To ask Tedd for a change to this PR, reply in Tedd's session on
[DOCS-1853](https://linear.app/supabase/issue/DOCS-1853/explain-how-a-local-edge-function-reaches-the-local-stack-and-services).
Tedd doesn't read comments on this PR.

---------

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: alexisintech <98043211+alexisintech@users.noreply.github.com>
2026-12-03 16:22:21 -07:00
Kody JacksonandClaude Sonnet 5.5 671c94e868 chore(docs,kb) - Update 301 destinations to final resolution + fix some 404s (#53553)
## Context

Lots of links that initially go to 301's within docs / kb. Updates these
to their resolved target.

Ask your Claude Code to review the new destinations programmatically.

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 15:10:08 +00:00
Kody JacksonandClaude Sonnet 5.5 39cf54f3c4 docs: add cross-links to related guides and references (#53384)
## What

Adds internal cross-links where a page mentions a product, feature, or
concept that has its own canonical page. This PR covers docs guides
under `apps/docs/content/guides`, excluding the shared partials
(separate PR).

## How links were chosen

- One canonical target per keyword, preferring docs guides over
marketing or blog pages for docs content.
- Only plain prose mentions: nothing inside headings, code, frontmatter,
existing links, or UI labels.
- One link per sentence, and no second link to the same target on a
page.

## Testing

- Prettier passes on all changed files.
- Not yet run: docs build and internal link test, KB build. Draft until
those are checked.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-16 09:59:49 -06:00
ec11e10d35 chore(docs) -- add in relevant crosslinks over to /kb troubleshooting pages (#52503)
## Problem

relevant cross-links missing to KB articles.

## Solution

Claude pass with an attempt to inline these where possible. Some were a
new sentence, but spot check felt like they were mostly appropriate.

## Preview links

N/A b/c too many atomic changes to help that much.

---------

Co-authored-by: Claude Haiku 5.5 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-10-29 10:30:15 -05: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
Miranda Limonczenko abbf667084 fix(docs) Resolve local link paths caused that have redirects (#48453)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## Problem

The Docs E2E link checker found broken links throughout docs, starting
with `phone-login.mdx` pointing to `/docs/guides/cli/config` (404).

Old links like `/docs/guides/cli/config` still work on the live site
because `supabase.com` has redirects set up for them, but these links
break on the docs preview site, which is what the E2E check tests
against. These issues look clean on the live site, and I didn't catch
them in my first pass because I was testing production instead of the
preview.

The E2E check only tests the ~20 pages a given PR happens to touch, so
fixing the pages it flagged kept exposing more of the same problem one
page at a time as each fix pulled in a new file. To stop chasing this
incrementally, I cross-referenced every `/docs/guides/*` and
`/docs/reference/*` redirect source in `apps/www/lib/redirects.js`
against actual usage across all of `apps/docs`, and verified each
candidate against the live preview.

## Solution

Rather than updating the Docs E2E link checker, this PR resolves the
links. **Why:** we own these docs, so keeping the links clean without
redirects is keeping the house maintained. See [Broken Window
Theory](https://blog.codinghorror.com/the-broken-window-theory/).

Updated every link still using an old path to point straight at the
current page instead of relying on a redirect. This covers old links
like:

- `/docs/guides/cli/config` →
`/docs/guides/local-development/cli/config`
- `/docs/guides/cli/getting-started` →
`/docs/guides/local-development/cli/getting-started`
- `/docs/guides/cli/local-development` →
`/docs/guides/local-development/database-migrations`
- `/docs/guides/cli/managing-environments` →
`/docs/guides/deployment/managing-environments`
- `/docs/guides/cli/seeding-your-database` →
`/docs/guides/local-development/seeding-your-database`
- bare `/docs/guides/cli` → `/docs/guides/local-development`
- `/docs/guides/platform/compute-add-ons` →
`/docs/guides/platform/compute-and-disk`
- `/docs/guides/platform/shared-responsibility-model` →
`/docs/guides/deployment/shared-responsibility-model`
- `/docs/guides/database` → `/docs/guides/database/overview`
- `/docs/reference/javascript`, `/docs/reference/dart`,
`/docs/reference/kotlin`, `/docs/reference/python`,
`/docs/reference/csharp` → their `/introduction` pages (the redirect's
own destination, `/start`, turned out to be dead even on production — a
separate bug in `redirects.js` I didn't touch here)
- and about 35 more of the same pattern, listed in the commit messages

Also fixed a handful of dead heading anchors found along the way (links
that resolve to the right page but point at a `#section` that got
renamed or moved), including the original `#bigquery` anchor and a few
in `connecting-to-postgres.mdx` where content moved to its own dedicated
page.

Left alone on purpose:
- `content/guides/cli.mdx` — this page has no route in the docs app at
all (no `app/guides/cli/` directory), so it 404s even in production
before the `www` redirect ever fires. Fixing its internal link wouldn't
change that; it needs an actual routing/content decision, not a link
fix.
- A few candidates that already resolve fine as-is (`pg_partman`, bare
`/docs/reference/api`, bare `/docs/reference/cli`) — confirmed via curl,
left untouched.

## Manual testing

1. Confirmed every new link target actually exists by checking the
destination file/page and matching heading anchors.
2. Cross-referenced every `/docs/guides/*` and `/docs/reference/*`
redirect source in `apps/www/lib/redirects.js` against real usage in
`apps/docs`, and curl-verified each old path (404) and new path (200)
against the live PR preview before fixing it.
3. Ran the Docs E2E link checker locally against changed pages.
4. Spot-checked the original broken link from CI
(`/docs/guides/cli/config`) to confirm it now points to a working page.
2026-07-29 14:47:17 -07:00
Lakshan PereraandJeremias Menichelli 4363dbb975 Some trivial fixes to Edge Function guides (#46092)
Was going through user feedback and fixed some of the minor issues with
the guides.

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

* **Documentation**
* Added guidance on handling CORS when invoking Edge Functions from the
browser (quickstart and dashboard)
* Updated Deno configuration guidance to reference a top-level deno.json
and adjusted recommended project structure
* Improved internal cross-references for templates and shared
documentation links in functions guides

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/46092?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Jeremias Menichelli <jmenichelli@gmail.com>
2026-05-20 05:53:47 +10:00
Chris ChinchillaandKalleby Santos b6dba956ef docs: Functions Key changes (#45224)
## 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**
* Replaced legacy "Anon"/"Service Role" key terminology with
"Publishable Keys" and "Secret Keys" across Edge Functions guides
* Updated authentication examples and request headers (client-side vs
server-side) to reflect publishable/secret key usage
* Standardized environment-variable examples to use parsed secret-key
maps with a selectable default
* Removed guidance for bypassing JWT verification via the deprecated CLI
flag
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Kalleby Santos <kalleby_santos@hotmail.com>
2026-04-29 11:12:54 +00:00
CharisandChris Chinchilla 47705a8968 chore: replace all supabase urls with relative urls (#38537)
* fix: rewrite relative URLs when syncing to GitHub discussion

Relative URLs back to supabse.com won't work in GitHub discussions, so
rewrite them back to absolute URLs starting with https://supabase.com

* fix: replace all supabase urls with relative urls

* chore: add linting for relative urls

* chore: bump linter version

* Prettier

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
2025-09-09 12:54:33 +00:00
Lydia HallieandCharis a26c01217d Update Edge Functions docs (#36798)
* Update Environment Variables docs

* Update Dependencies docs

* Add Function Configuration d ocs

* Add custom Configuration section in Navigation

* Add Error Handling section

* Add new HTTP Methods section

* Update Deno 2 Guide

* Update nav

* Rm deno2 nav

* Update Deploy section

* Update CI/CD section

* Update Logging

* Update Testing

* Update Local Debugging

* Update Troubleshooting

* Update Nav

* Update CLI Quickstart

* Update Dashboard Quickstart

* Update Development Environment

* Update Nav

* Fix links

* Update apps/docs/content/guides/functions/quickstart-dashboard.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/development-environment.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/development-environment.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/quickstart.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Use $CodeSample for multi-root example

* Use tocVideo instead of video embed

* Rm typo

* Switch Quickstart ordering

* Rephrase Docker requirement for deployment

* Add Project Structure section

* style: fix docs lint issues

* Update Regional Invocations

* Update Error Handing

* Fix linting

* Fixes

* Remove duplicate sections

* Update Auth integration

* Update Storage

* Update Database/Postgres

* Update Nav

* Update Background Tasks

* Update Ephemeral Storage

* Update Websockets

* Update Routing

* Update wasm

* Update AI models

* Fix linting issues

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/storage-caching.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/websockets.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/websockets.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Update apps/docs/content/guides/functions/ai-models.mdx

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>

* Rm unnecessary lines

* Rm wrong example

* Fix typo

* Rm deno2

* Move CICD to deployment and rename routing

* Fix whitespace

* rm unnecessary spelling

---------

Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
2025-07-10 14:18:01 +00:00