From e0948271f50bf2fe9ac9b6dee81ac43c146851f6 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Mon, 3 Oct 2022 15:04:28 +0000 Subject: [PATCH] fix: Check for a response body when dialing the Tailnet WebSocket There was a panic in this code that caused it to fail on error! --- codersdk/workspaceagents.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codersdk/workspaceagents.go b/codersdk/workspaceagents.go index 6979aaf46bd71..ee589440cbda0 100644 --- a/codersdk/workspaceagents.go +++ b/codersdk/workspaceagents.go @@ -332,7 +332,7 @@ func (c *Client) DialWorkspaceAgentTailnet(ctx context.Context, logger slog.Logg CompressionMode: websocket.CompressionDisabled, }) if isFirst { - if err != nil && res.StatusCode == http.StatusConflict { + if res != nil && res.StatusCode == http.StatusConflict { first <- readBodyAsError(res) return }