Skip to content

Commit 748d586

Browse files
authored
warn instead of erroring if no exposed ports. and remove unused dev_exposed_ports (#9573)
* remove dev_exposed_ports * warn instead of erroring if no ports eposed * fixups
1 parent 49f5ac7 commit 748d586

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

packages/miniflare/src/plugins/containers/service/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class ContainerController {
7575
if (output === "0" && process.platform !== "linux") {
7676
throw new Error(
7777
`The container "${imageTag.replace(MF_CONTAINER_PREFIX + "/", "")}" does not expose any ports.\n` +
78-
"To develop containers locally on non-Linux platforms, you must expose any ports that you call with `getTCPPort() in your Dockerfile."
78+
"To develop containers locally on non-Linux platforms, you must expose any ports that you call with `getTCPPort()` in your Dockerfile."
7979
);
8080
}
8181
}

packages/wrangler/e2e/containers.dev.test.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,24 +119,23 @@ describe.skipIf(process.platform !== "linux" && process.env.CI === "true")(
119119
});
120120
});
121121
it.skipIf(process.platform === "linux")(
122-
"errors in windows/macos if no ports are exposed, but not on linux",
122+
"warns in windows/macos if no ports are exposed, but not on linux",
123123
async () => {
124124
const worker = helper.runLongLived("wrangler dev");
125-
expect(await worker.exitCode).toBe(1);
126-
expect(await worker.output).toContain(
127-
'The container "http2" does not expose any ports.'
128-
);
125+
await worker.readUntil(/does not expose any ports/);
126+
await worker.readUntil(/Container\(s\) built and ready/);
129127
}
130128
);
131129

132130
it.skipIf(process.platform !== "linux")(
133-
"doesn't error in linux if no ports are exposed",
131+
"doesn't warn in linux if no ports are exposed",
134132
async () => {
135133
const worker = helper.runLongLived("wrangler dev");
136134
await worker.waitForReady();
137135
await worker.readUntil(/Building container/);
138136
await worker.readUntil(/DONE/);
139137
await worker.readUntil(/Container\(s\) built and ready/);
138+
expect(worker.output).not.toContain("does not expose any ports");
140139
}
141140
);
142141
});

packages/wrangler/src/api/startDevWorker/ConfigController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,6 @@ function resolveContainerConfig(
438438
image: container.image ?? container.configuration.image,
439439
maxInstances: container.max_instances,
440440
imageBuildContext: container.image_build_context,
441-
exposedPorts: container.dev_exposed_ports,
442441
name: container.name,
443442
};
444443
}

packages/wrangler/src/config/environment.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,6 @@ export type ContainerApp = {
104104
* - manual: The container application will be rollout fully by manually actioning progress steps.
105105
*/
106106
rollout_kind?: "full_auto" | "none" | "full_manual";
107-
108-
/**
109-
* Ports to be exposed by the container application. Only applies to dev, on non-linux machines, and if the Dockerfile doesn't already declare exposed ports.
110-
*/
111-
dev_exposed_ports?: number[];
112107
};
113108

114109
/**

0 commit comments

Comments
 (0)