aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/src/entrypoints/server.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/integrations/cloudflare/src/entrypoints/server.ts')
-rw-r--r--packages/integrations/cloudflare/src/entrypoints/server.ts5
1 files changed, 5 insertions, 0 deletions
diff --git a/packages/integrations/cloudflare/src/entrypoints/server.ts b/packages/integrations/cloudflare/src/entrypoints/server.ts
index af4106b4e..e17dd6a25 100644
--- a/packages/integrations/cloudflare/src/entrypoints/server.ts
+++ b/packages/integrations/cloudflare/src/entrypoints/server.ts
@@ -5,8 +5,10 @@ import type {
} from '@cloudflare/workers-types';
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
+import { createGetEnv } from '../utils/env.js';
type Env = {
+ [key: string]: unknown;
ASSETS: { fetch: (req: Request | string) => Promise<Response> };
ASTRO_STUDIO_APP_TOKEN?: string;
};
@@ -69,6 +71,9 @@ export function createExports(manifest: SSRManifest) {
},
},
};
+ // Won't throw if the virtual module is not available because it's not supported in
+ // the users's astro version or if astro:env is not enabled in the project
+ await import('astro/env/setup').then((mod) => mod.setGetEnv(createGetEnv(env))).catch(() => {});
const response = await app.render(request, { routeData, locals });