diff --git a/src/utils.ts b/src/utils.ts index f2d52c5..15d0328 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -417,7 +417,9 @@ type getEnvArgs = { export function getEnv({Astro, key}: getEnvArgs) { if (Astro) { return ( - Astro.locals.runtime.env[key] || import.meta.env[key] || process.env[key] + Astro.locals?.runtime?.env[key] || + import.meta.env[key] || + process.env[key] ); } return import.meta.env[key] || process.env[key];