Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/mighty-heads-shine.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@opennextjs/cloudflare": patch
---

When running `wrangler deploy` add a `OPEN_NEXT_DEPLOY` environment variable to let wrangler know that it is being run by open-next
7 changes: 7 additions & 0 deletions packages/cloudflare/src/cli/commands/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export async function deployCommand(args: WithWranglerArgs<{ cacheChunkSize?: nu
],
{
logging: "all",
env: {
// If we are running the deploy command we set this OPEN_NEXT_DEPLOY environment variable
// to let `wrangler deploy` know that it is being run from open-next. We do this because
// otherwise `wrangler deploy` run in an open-next project would call
// `opennextjs-cloudflare deploy` (thus causing an unwanted recursion).
OPEN_NEXT_DEPLOY: "true",
},
}
);
}
Expand Down
2 changes: 2 additions & 0 deletions packages/cloudflare/src/cli/utils/run-wrangler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type WranglerOptions = {
environment?: string;
configPath?: string;
logging?: "all" | "error";
env?: Record<string, unknown>;
};

/**
Expand Down Expand Up @@ -83,6 +84,7 @@ export function runWrangler(options: BuildOptions, args: string[], wranglerOpts:
// Wrangler would load `.env.<wrangler env>` while we should load `.env.<process.env.NEXTJS_ENV>`
// See https://opennext.js.org/cloudflare/howtos/env-vars
CLOUDFLARE_LOAD_DEV_VARS_FROM_DOT_ENV: "false",
...wranglerOpts.env,
},
}
);
Expand Down
Loading