Skip to content

Commit ac8dd81

Browse files
JuulapsJuul
authored andcommitted
feat: support passing options to platform proxy
1 parent bdc95fb commit ac8dd81

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
import type { DurableObjectQueueHandler } from "./durable-objects/queue";
46
import { DOShardedTagCache } from "./durable-objects/sharded-tag-cache";
57

@@ -290,12 +292,13 @@ async function monkeyPatchVmModuleEdgeContext(cloudflareContext: CloudflareConte
290292
async function getCloudflareContextFromWrangler<
291293
CfProperties extends Record<string, unknown> = IncomingRequestCfProperties,
292294
Context = ExecutionContext,
293-
>(): Promise<CloudflareContext<CfProperties, Context>> {
295+
>(options?: Omit<GetPlatformProxyOptions, "environment">): Promise<CloudflareContext<CfProperties, Context>> {
294296
// Note: we never want wrangler to be bundled in the Next.js app, that's why the import below looks like it does
295297
const { getPlatformProxy } = await import(/* webpackIgnore: true */ `${"__wrangler".replaceAll("_", "")}`);
296298
const { env, cf, ctx } = await getPlatformProxy({
297299
// This allows the selection of a wrangler environment while running in next dev mode
298300
environment: process.env.NEXT_DEV_WRANGLER_ENV,
301+
...options,
299302
});
300303
return {
301304
env,

0 commit comments

Comments
 (0)