molecule-core/.github/workflows
Hongming Wang b9e1f1e88e fix(ci): bake api.moleculesai.app into tenant canvas bundle
Canvas's browser-side code (auth.ts, api.ts, billing.ts) all call
fetch(PLATFORM_URL + /cp/*). PLATFORM_URL comes from
NEXT_PUBLIC_PLATFORM_URL at build time; with the build arg unset,
it falls back to http://localhost:8080 in the compiled bundle.

That means on a tenant like hongmingwang.moleculesai.app, the
user's browser actually tried to fetch http://localhost:8080/cp/
auth/me — which resolves to the USER'S OWN machine, not the tenant.
Login redirect loops 404. Every tenant canvas has been unable to
complete a fresh login on this path; existing sessions only worked
because the cookie was already set domain-wide.

Fix: pass NEXT_PUBLIC_PLATFORM_URL=https://api.moleculesai.app
as a build arg in the tenant-image workflow. CP already allows
CORS from *.moleculesai.app + credentials, and the session cookie
is scoped to .moleculesai.app so tenant subdomains inherit it.

Verified in prod by rebuilding canvas locally with the flag and
hot-patching the hongmingwang instance via SSM. Baked chunks now
contain api.moleculesai.app; browser auth redirects resolve
cleanly to the CP.

Self-hosted users override by rebuilding with their own URL —
same pattern molecule-app uses with NEXT_PUBLIC_CP_ORIGIN.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 12:51:22 -07:00
..
canary-verify.yml fix(ci): replace sleep 360 with health-check poll in canary-verify (#1013) 2026-04-19 19:29:15 -07:00
ci.yml ci: update GitHub Actions to current stable versions (closes #780) 2026-04-18 12:04:10 -07:00
codeql.yml ci(codeql): cover main + staging via workflow 2026-04-19 14:34:04 -07:00
e2e-api.yml fix(ci): update working-directory for workspace-server/ and workspace/ renames 2026-04-18 07:05:44 -07:00
promote-latest.yml ci(promote-latest): suppress brew cleanup that hits perm-denied on shared runner 2026-04-19 05:55:45 -07:00
publish-canvas-image.yml ci: update GitHub Actions to current stable versions (closes #780) 2026-04-18 12:04:10 -07:00
publish-workspace-server-image.yml fix(ci): bake api.moleculesai.app into tenant canvas bundle 2026-04-20 12:51:22 -07:00