Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
9 changes: 9 additions & 0 deletions .changeset/moody-goats-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"wrangler": minor
---

Adds the `--force-subdomain-deploy` flag to the `wrangler triggers deploy` command.

Wrangler will sometimes skip the API call if the config file matches
the remote state. The flag lets us skip this behavior, and force the
subdomain deployment.
9 changes: 6 additions & 3 deletions packages/wrangler/src/triggers/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type Props = {
legacyEnv: boolean | undefined;
dryRun: boolean | undefined;
assetsOptions: AssetsOptions | undefined;
forceSubdomainDeploy?: boolean;
};

export default async function triggersDeploy(
Expand Down Expand Up @@ -90,7 +91,8 @@ export default async function triggersDeploy(
envName,
workerUrl,
routes,
deployments
deployments,
props.forceSubdomainDeploy ?? false
);

if (!wantWorkersDev && workersDevInSync && routes.length !== 0) {
Expand Down Expand Up @@ -315,7 +317,8 @@ async function subdomainDeploy(
envName: string,
workerUrl: string,
routes: Route[],
deployments: Array<Promise<string[]>>
deployments: Array<Promise<string[]>>,
forceSubdomainDeploy: boolean
Copy link
Contributor

@vicb vicb Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to add an arg, given that we pass props.forceSubdomainDeploy and props is already the first arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like it is good to be explicit about forcing here. I want to get rid of props arg eventually.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please reconsider this for now?

You can still explicitly pass props.forceSubdomainDeploy later at the time you refactor the code.

) {
const { config } = props;

Expand Down Expand Up @@ -375,7 +378,7 @@ async function subdomainDeploy(

// Update subdomain enablement status if needed.

if (!allInSync) {
if (!allInSync || forceSubdomainDeploy) {
await fetchResult(config, `${workerUrl}/subdomain`, {
method: "POST",
body: JSON.stringify({
Expand Down
6 changes: 6 additions & 0 deletions packages/wrangler/src/triggers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ export const triggersDeployCommand = createCommand({
describe: "Use legacy environments",
hidden: true,
},
"force-subdomain-deploy": {
type: "boolean",
describe:
"Force deployment of subdomain triggers, even if the they are in sync.",
},
},
behaviour: {
warnIfMultipleEnvsConfiguredButNoneSpecified: true,
Expand All @@ -74,6 +79,7 @@ export const triggersDeployCommand = createCommand({
legacyEnv: isLegacyEnv(config),
dryRun: args.dryRun,
assetsOptions,
forceSubdomainDeploy: args.forceSubdomainDeploy,
});
},
});
Loading