From 51687c74c8bce0bfd42b8ae68ef1803109aa18a9 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 7 Dec 2023 21:10:12 +0000 Subject: [PATCH] fix(coderd/healthcheck): do not return null regions in RegionsResponse (#11088) --- coderd/healthcheck/workspaceproxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/coderd/healthcheck/workspaceproxy.go b/coderd/healthcheck/workspaceproxy.go index dd6bf5257f..1bca7452fd 100644 --- a/coderd/healthcheck/workspaceproxy.go +++ b/coderd/healthcheck/workspaceproxy.go @@ -77,6 +77,10 @@ func (r *WorkspaceProxyReport) Run(ctx context.Context, opts *WorkspaceProxyRepo } r.WorkspaceProxies = proxies + if r.WorkspaceProxies.Regions == nil { + r.WorkspaceProxies.Regions = make([]codersdk.WorkspaceProxy, 0) + } + // Stable sort based on create timestamp. sort.Slice(r.WorkspaceProxies.Regions, func(i int, j int) bool { return r.WorkspaceProxies.Regions[i].CreatedAt.Before(r.WorkspaceProxies.Regions[j].CreatedAt)