fix(dev): pass Stripe checkout redirect URLs to the api on dev-sso (BUNYIP-175) #208
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/BUNYIP-175-dev-sso-checkout-urls"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Follow-up to #207 (which wired the Stripe keys). With keys flowing, the Subscribe button on the dev-sso stack still breaks at the final click: Stripe rejects the checkout session because
success_urlis malformed.Checkout uses
config.success_url/config.cancel_url, and those are always env-derived (STRIPE_SUCCESS_URL/STRIPE_CANCEL_URL, else{CORS_ORIGIN}/...); the DB/admin Stripe config never overrides them (StripeConfig::from_db_modelcopies them straight from the env config). On dev-ssoCORS_ORIGINis a comma-list of relying-party origins, so the derived URL becomeshttps://<user>-bunyip.a8n.run,https://<user>-mokosh.a8n.run/checkout/success.The override vars exist, but compose.dev.yml never forwarded them to the api container (no
env_file:), so setting them in.envdid nothing.Fix
Add
STRIPE_SUCCESS_URL+STRIPE_CANCEL_URLto the apienvironment:block (${VAR:-}pattern). Empty default keeps plainjust devworking (single localhost CORS_ORIGIN derives a valid URL). On dev-sso, set them in.envto a single bunyip origin; documented in the.env.exampledev Stripe block.Verified
docker compose -f compose.dev.yml -f compose.dev-sso.yml configresolves both into the api service once.envsets them.🤖 Generated with Claude Code
Checkout sessions use `config.success_url` / `config.cancel_url`, which are always env-derived: `STRIPE_SUCCESS_URL` / `STRIPE_CANCEL_URL` when set, otherwise `{CORS_ORIGIN}/checkout/success` and `{CORS_ORIGIN}/pricing?checkout=canceled`. The DB/admin Stripe config never overrides them. On the dev-sso (Traefik) stack CORS_ORIGIN is a comma-list of relying-party origins (`https://<user>-bunyip.a8n.run,https://<user>-mokosh.a8n.run`), so the derived success_url becomes `https://<user>-bunyip.a8n.run,https://<user>-mokosh.a8n.run/checkout/success` - a malformed URL Stripe rejects at checkout-session creation, breaking the Subscribe button at the final step. The two override vars were the fix, but compose.dev.yml never forwarded them to the api container (no `env_file:`), so setting them in `.env` had no effect. Add both to the api `environment:` block with the `${VAR:-}` pattern. Empty default preserves plain `just dev` behaviour (single localhost CORS_ORIGIN derives a valid URL); on dev-sso set them in `.env` to a single bunyip origin. Documented in the `.env.example` dev Stripe block. #BUNYIP-175 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>