fix(webapp): let build env var decrypt failures fall through to the generic error

This commit is contained in:
Saadi Myftija
2026-08-21 16:58:22 +02:00
parent a21baf018a
commit 9ca53a074c
2 changed files with 2 additions and 20 deletions
@@ -86,24 +86,8 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
);
}
let variables: Record<string, string>;
try {
const decrypted = await decryptSecret(env.ENCRYPTION_KEY, envelope.data);
variables = z.record(z.string()).parse(JSON.parse(decrypted));
} catch (error) {
logger.error("Failed to decrypt stored build env vars", {
deploymentId,
environmentId: authenticatedEnv.id,
error,
});
return json(
{
error: "The stored build environment variables could not be decrypted. Retry the deploy.",
},
{ status: 500 }
);
}
const decrypted = await decryptSecret(env.ENCRYPTION_KEY, envelope.data);
const variables = z.record(z.string()).parse(JSON.parse(decrypted));
return json({ variables } satisfies GetDeploymentBuildEnvVarsResponseBody, { status: 200 });
} catch (error) {
@@ -1236,8 +1236,6 @@ export function isCloud(): boolean {
return true;
}
// Preview environments are cloud installs too; without this the billing client silently no-ops.
// Optional chaining because test suites mock the env module with partial objects.
if (env.LOGIN_ORIGIN?.endsWith(".triggerlabs.dev")) {
return true;
}