Skip to content

Commit d7385c2

Browse files
committed
feat: support passing options to platform proxy
1 parent 366d325 commit d7385c2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/cloudflare/src/api/cloudflare-context.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { Context, RunningCodeOptions } from "node:vm";
22

3+
import type { GetPlatformProxyOptions } from "wrangler";
4+
35
declare global {
46
interface CloudflareEnv {
57
NEXT_CACHE_WORKERS_KV?: KVNamespace;
@@ -250,12 +252,13 @@ async function monkeyPatchVmModuleEdgeContext(cloudflareContext: CloudflareConte
250252
async function getCloudflareContextFromWrangler<
251253
CfProperties extends Record<string, unknown> = IncomingRequestCfProperties,
252254
Context = ExecutionContext,
253-
>(): Promise<CloudflareContext<CfProperties, Context>> {
255+
>(options?: Omit<GetPlatformProxyOptions, "environment">): Promise<CloudflareContext<CfProperties, Context>> {
254256
// Note: we never want wrangler to be bundled in the Next.js app, that's why the import below looks like it does
255257
const { getPlatformProxy } = await import(/* webpackIgnore: true */ `${"__wrangler".replaceAll("_", "")}`);
256258
const { env, cf, ctx } = await getPlatformProxy({
257259
// This allows the selection of a wrangler environment while running in next dev mode
258260
environment: process.env.NEXT_DEV_WRANGLER_ENV,
261+
...options,
259262
});
260263
return {
261264
env,

0 commit comments

Comments
 (0)