Mailer drops path component of API_EXTERNAL_URL when building confirmation URLs
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- go
- Domain
- authentication, backend-api-design
Research direction
Start at the mailer URL-building code that parses API_EXTERNAL_URL and appends the GOTRUE_MAILER_URLPATHS_* suffix; search for those configuration names and reproduce with the documented OTP request. Check confirmation, recovery, invite, and email-change links through the Mailpit flow. Done means a configured path such as /auth/v1 is preserved and the generated confirmation URL reaches the routed endpoint.
Written by the indexing model from the issue text.
Description
Summary
When API_EXTERNAL_URL contains a path component (e.g. http://127.0.0.1:54321/auth/v1), the mailer discards the path while building confirmation URLs, producing links that 404 when routed through an API gateway.
Versions
- Supabase CLI: 2.98.1
- Bundled auth image:
public.ecr.aws/supabase/gotrue:v2.188.1
Reproduction
- Run a local Supabase stack with default config; the auth container's env will contain
API_EXTERNAL_URL=http://127.0.0.1:54321/auth/v1andGOTRUE_MAILER_URLPATHS_CONFIRMATION=/verify. - Setting
[auth] external_url = "http://127.0.0.1:54321/auth/v1"explicitly insupabase/config.tomldoes not change the behavior (also reproduces with the stock default). POST http://127.0.0.1:54321/auth/v1/otpwith{ "email": "<seeded user>", "create_user": false }.- Inspect the resulting magic-link email in Mailpit (
http://127.0.0.1:54324).
Expected
Link URL is http://127.0.0.1:54321/auth/v1/verify?token=...&type=magiclink&redirect_to=....
Actual
Link URL is http://127.0.0.1:54321/verify?token=...&type=magiclink&redirect_to=... — missing /auth/v1.
Clicking returns Kong's {"message":"no Route matched with those values"} 404, since Kong only has a route registered for /auth/v1/verify.
Verified end-to-end:
GET /verify?...→ 404 (no Kong route)GET /auth/v1/verify?...→ 303 with a validaccess_tokenJWT in the redirect Location
Apparent root cause
The mailer parses API_EXTERNAL_URL and uses only <scheme>://<host> when concatenating the GOTRUE_MAILER_URLPATHS_* suffix — discarding any path component. With URLPATHS_CONFIRMATION=/verify and API_EXTERNAL_URL=http://127.0.0.1:54321/auth/v1, the result is http://127.0.0.1:54321/verify instead of http://127.0.0.1:54321/auth/v1/verify.
This presumably also affects the recovery, invite, and email-change paths, all of which share the same URL-building code path.
Workaround
Override the magic_link email template via Supabase CLI config and hardcode the corrected URL using {{ .TokenHash }}, {{ .RedirectTo }}, and the literal /auth/v1/verify path.
Impact
Anyone running a recent Supabase CLI locally cannot use magic-link auth out of the box without a template override or manual URL surgery. Filed downstream as johnnyrw/book-keeper#66.
- Dominant language
- Go
- Stars
- 2.6k
- Forks
- 764
- Avg merge
- 5d 3h
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/auth
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Similar issues
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
blinklabs-io/bursa#904 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
yanet-platform/ipfw-go#129 ·
-
bug confmap/provider/googlesecretmanagerprovider needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
open-telemetry/opentelemetry-collector-contrib#51273 · 2 comments ·
-
bug: AI Gateway client filter lists "Unknown" twice when NULL and literal Unknown clients coexist Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 90/100