From 95dc902b18b0146ef41b2ae1abdd38bd10c6dcf9 Mon Sep 17 00:00:00 2001 From: Jason Park Date: Sat, 16 Sep 2023 16:07:44 +0900 Subject: [PATCH] fix: fixing variable name typo --- lib/configs/amplify/build-setting.ts | 2 +- lib/constructs/presentation/web-app.ts | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/configs/amplify/build-setting.ts b/lib/configs/amplify/build-setting.ts index 867860a2b..8b9caa1d0 100644 --- a/lib/configs/amplify/build-setting.ts +++ b/lib/configs/amplify/build-setting.ts @@ -3,7 +3,7 @@ import { microAppCorsHeader, securityHeaders } from './website'; export const BIT_TOKEN = process.env.BIT_TOKEN!; export const FEEDS_DEPLOY_KEY = process.env.DEPLOY_KEY!; -export const MASTER_VITE_GA_ID = process.env.VITE_GA_ID!; +export const MASTER_VITE_GA_ID = process.env.MASTER_VITE_GA_ID!; export const DEV_VITE_GA_ID = process.env.DEV_VITE_GA_ID!; const preBuild = { diff --git a/lib/constructs/presentation/web-app.ts b/lib/constructs/presentation/web-app.ts index 2eb671c72..7ee8241f1 100644 --- a/lib/constructs/presentation/web-app.ts +++ b/lib/constructs/presentation/web-app.ts @@ -38,9 +38,17 @@ export class AmplifyMonoWebApp extends AbstractWebApp { constructor(scope: Construct, id: string, props: WebAppProps) { super(scope, id, props); - if (!MASTER_VITE_GA_ID || !DEV_VITE_GA_ID) { - throw new Error('Required environment variables are missing.'); + const missingVars = []; + + if (!MASTER_VITE_GA_ID) missingVars.push('MASTER_VITE_GA_ID'); + if (!DEV_VITE_GA_ID) missingVars.push('DEV_VITE_GA_ID'); + + if (missingVars.length > 0) { + throw new Error( + `Required environment variables are missing: ${missingVars.join(', ')}`, + ); } + this.appProps = props; this.app = new amplify.App(this, 'root-app', {