Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.4k
chore: retire legacy v3 dev websocket + delete legacy self-hosting docs#4198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| --- | ||
| area: webapp | ||
| type: breaking | ||
| --- | ||
| Removed support for the end-of-life v3 `trigger dev` CLI. Starting a dev session with an old v3 CLI now returns an upgrade message instead of connecting - upgrade to the v4 CLI to continue using `trigger dev`. |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -3,31 +3,15 @@ import { WebSocketServer, type WebSocket } from "ws"; | ||
| import { authenticateApiKey } from "~/services/apiAuth.server"; | ||
| import { logger } from "~/services/logger.server"; | ||
| import { singleton } from "../utils/singleton"; | ||
| import { AuthenticatedSocketConnection } from "./authenticatedSocketConnection.server"; | ||
| import { Gauge } from "prom-client"; | ||
| import { metricsRegister } from "~/metrics.server"; | ||
| import { isV3Disabled, V3_DEV_DEPRECATION_MESSAGE } from "./engineDeprecation.server"; | ||
| import { V3_DEV_DEPRECATION_MESSAGE } from "./engineDeprecation.server"; | ||
| export const wss = singleton("wss", initalizeWebSocketServer); | ||
| let authenticatedConnections: Map<string, AuthenticatedSocketConnection>; | ||
| function initalizeWebSocketServer() { | ||
| const server = new WebSocketServer({ noServer: true }); | ||
| server.on("connection", handleWebSocketConnection); | ||
| authenticatedConnections = new Map(); | ||
| new Gauge({ | ||
| name: "dev_authenticated_connections", | ||
| help: "Number of authenticated dev connections", | ||
| collect() { | ||
| this.set(authenticatedConnections.size); | ||
| }, | ||
| registers: [metricsRegister], | ||
| }); | ||
| return server; | ||
| } | ||
| @@ -59,35 +43,14 @@ async function handleWebSocketConnection(ws: WebSocket, req: IncomingMessage) { | ||
| const authenticatedEnv = authenticationResult.environment; | ||
| // This legacy websocket is only used by the v3 `trigger dev` CLI (v4 uses a | ||
| // different dev transport). When the v3 shutdown is on, close it with a | ||
| // graceful reason instead of letting the CLI sit connected with no work. | ||
| if (isV3Disabled()) { | ||
| logger.warn("Rejected deprecated v3 dev CLI websocket connection", { | ||
| environmentId: authenticatedEnv.id, | ||
| projectId: authenticatedEnv.projectId, | ||
| organizationId: authenticatedEnv.organizationId, | ||
| }); | ||
| ws.close(1008, V3_DEV_DEPRECATION_MESSAGE); | ||
| return; | ||
| } | ||
| const authenticatedConnection = new AuthenticatedSocketConnection( | ||
| ws, | ||
| authenticatedEnv, | ||
| req.headers["x-forwarded-for"] ?? req.socket.remoteAddress ?? "unknown" | ||
| ); | ||
| authenticatedConnections.set(authenticatedConnection.id, authenticatedConnection); | ||
| authenticatedConnection.onClose.attachOnce((closeEvent) => { | ||
| logger.debug("Websocket closed", { | ||
| closeEvent, | ||
| authenticatedConnectionId: authenticatedConnection.id, | ||
| }); | ||
| authenticatedConnections.delete(authenticatedConnection.id); | ||
| // This websocket is only used by the legacy v3 `trigger dev` CLI (v4 uses a | ||
| // different dev transport). The v3 engine is end-of-lifed, so there is no | ||
| // longer any work to run here — close with the graceful upgrade message so | ||
| // an old CLI is told what to do instead of sitting connected. | ||
| logger.warn("Rejected deprecated v3 dev CLI websocket connection", { | ||
| environmentId: authenticatedEnv.id, | ||
| projectId: authenticatedEnv.projectId, | ||
| organizationId: authenticatedEnv.organizationId, | ||
| }); | ||
| await authenticatedConnection.initialize(); | ||
| ws.close(1008, V3_DEV_DEPRECATION_MESSAGE); | ||
nicktrn marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. nicktrn marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. nicktrn marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.