Skip to content

Commit 342cf81

Browse files
t3dotggclaude
andcommitted
fix(server): reject unsupported relay runtimes before touching the connector
A relay-config payload with a manual or t3_relay runtime stopped the active Cloudflare connector on its way to the 503. The provider kind is now checked first and the connector is left alone. Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent 31b0e4f commit 342cf81

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

‎apps/server/src/cloud/http.ts‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,16 +618,18 @@ const applyCloudRelayConfig = Effect.fn("environment.cloud.applyRelayConfig")(fu
618618
cloudUserId: payload.cloudUserId,
619619
});
620620
yield* validateCloudMintPublicKey(payload.cloudMintPublicKey);
621+
// Reject unsupported runtimes before touching the connector so a bad
622+
// payload cannot stop a healthy tunnel on its way to a 503.
621623
if (
622624
payload.endpointRuntime !== null &&
623625
payload.endpointRuntime.providerKind !== "cloudflare_tunnel"
624626
) {
625-
const endpointRuntimeStatus = yield* dependencies.endpointRuntime.applyConfig(
626-
payload.endpointRuntime,
627-
);
628627
return yield* new EnvironmentCloudEndpointUnavailableError({
629628
message: "Managed endpoint runtime could not be started.",
630-
endpointRuntimeStatus,
629+
endpointRuntimeStatus: {
630+
status: "unsupported",
631+
providerKind: payload.endpointRuntime.providerKind,
632+
},
631633
});
632634
}
633635
yield* dependencies.endpointRuntime.applyConfig(null);

‎apps/server/src/server.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,9 +3218,8 @@ it.layer(NodeServices.layer)("server router seam", (it) => {
32183218
assert.equal(relayConfigResponse.status, 503);
32193219
assert.equal(relayConfigBody._tag, "EnvironmentCloudEndpointUnavailableError");
32203220
assert.equal(relayConfigBody.endpointRuntimeStatus?.status, "unsupported");
3221-
assert.deepEqual(appliedRuntimeConfigs, [
3222-
{ providerKind: "manual", connectorToken: "manual-token" },
3223-
]);
3221+
// The connector is never touched for a rejected runtime.
3222+
assert.deepEqual(appliedRuntimeConfigs, []);
32243223
assert.equal(linkStateResponse.status, 200);
32253224
assert.equal(linkStateBody.linked, false);
32263225
}).pipe(Effect.provide(NodeHttpServer.layerTest)),

0 commit comments

Comments
 (0)