fix(webapp): tolerate missing LOGIN_ORIGIN in isCloud

Test suites mock the env module with partial objects and import this
module transitively, so the preview-host check must not assume the
variable is set even though the schema gives it a default.
This commit is contained in:
Saadi Myftija
2026-07-24 15:49:47 +02:00
parent f3594dc47b
commit 8abbe0571a
@@ -1239,7 +1239,9 @@ export function isCloud(): boolean {
// PR preview environments are cloud-style installs running against the
// cloud's staging services. Without this, anything gated on the billing
// client silently no-ops there (e.g. remote builds never get enqueued).
if (env.LOGIN_ORIGIN.endsWith(".triggerlabs.dev")) {
// Optional chaining: LOGIN_ORIGIN has a schema default, but test suites mock
// ~/env.server with partial objects and import this module transitively.
if (env.LOGIN_ORIGIN?.endsWith(".triggerlabs.dev")) {
return true;
}