Skip to content

Commit 03ee7b0

Browse files
committed
fix(ci): do not point a preview's portal reads at an unconfirmed base
The backend's saas-base-url default is https://stirling.com/app, a subpath URL nobody has confirmed answers /api/v1, and prod CORS lists three named origins that do not include preview hostnames. Handing that to VITE_SAAS_API_URL would trade today's clean "not configured" portal state for 404s or a CORS wall. The browser now gets a base only from the explicit variable, so the two halves still move together when it is set, and previews link without it.
1 parent 947c080 commit 03ee7b0

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

.github/workflows/PR-Auto-Deploy-V2.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ jobs:
231231
PROJECT_REF: ${{ secrets.SAAS_DB_PROJECT_REF }}
232232
API_BASE_OVERRIDE: ${{ vars.SAAS_API_BASE_URL }}
233233
run: |
234-
# One value for both halves. The browser's reads and the backend's register/entitlement
235-
# calls have to land on the same SaaS, and nothing checks that they do. Optional, because
236-
# the backend already defaults to prod - set it only to point a preview elsewhere.
234+
# Set, this is the one value both halves use: the browser's portal reads and the backend's
235+
# register/entitlement calls have to land on the same SaaS, and nothing checks that they
236+
# do. Unset, only the backend gets a base, from its own compiled-in default.
237237
API_BASE="${API_BASE_OVERRIDE:-https://stirling.com/app}"
238238
echo "backend_base=${API_BASE}" >> "$GITHUB_OUTPUT"
239239
@@ -242,16 +242,18 @@ jobs:
242242
echo "account, and the connect dialog will say so. To wire one up, set on the"
243243
echo "pr-preview environment the secrets SAAS_DB_PROJECT_REF and"
244244
echo "SAAS_SUPABASE_PUBLISHABLE_KEY, both from the same Supabase project."
245-
# Moves with the Supabase pair, so an unconfigured preview stays wholly unconfigured
246-
# instead of aiming its reads at an account it cannot sign in to.
247245
echo "supabase_url=" >> "$GITHUB_OUTPUT"
248246
echo "frontend_base=" >> "$GITHUB_OUTPUT"
249247
else
250248
# Only whether, not which: the ref is a secret here, so Actions masks it out of any
251249
# line it appears in, derived URL included.
252250
echo "Stirling account configured, at ${API_BASE}."
253251
echo "supabase_url=https://${PROJECT_REF}.supabase.co" >> "$GITHUB_OUTPUT"
254-
echo "frontend_base=${API_BASE}" >> "$GITHUB_OUTPUT"
252+
# Deliberately the override and not API_BASE: the backend's default is a subpath URL
253+
# nobody has confirmed answers /api/v1, and prod CORS does not list preview hostnames,
254+
# so portal reads stay off until someone sets a base they have checked. Empty leaves the
255+
# committed .env default alone, which is the clean "not configured" state.
256+
echo "frontend_base=${API_BASE_OVERRIDE}" >> "$GITHUB_OUTPUT"
255257
fi
256258
257259
- name: Check if image exists

0 commit comments

Comments
 (0)