From 12a43a2d47e5d2fff4297a515ebc96322a97d8ef Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Thu, 1 Sep 2022 18:33:41 +0000 Subject: [PATCH] fix: Use an unnamed region instead of erroring for DERP --- coderd/workspaceagents.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/coderd/workspaceagents.go b/coderd/workspaceagents.go index 5ed39af446de1..e65e11ad2dc5e 100644 --- a/coderd/workspaceagents.go +++ b/coderd/workspaceagents.go @@ -701,7 +701,13 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator *tailnet.Coordi } region, found := derpMap.Regions[regionID] if !found { - return codersdk.WorkspaceAgent{}, xerrors.Errorf("region %d not found in derpmap", regionID) + // It's possible that a workspace agent is using an old DERPMap + // and reports regions that do not exist. If that's the case, + // report the region as unknown! + region = &tailcfg.DERPRegion{ + RegionID: regionID, + RegionName: fmt.Sprintf("Unnamed %d", regionID), + } } workspaceAgent.DERPLatency[region.RegionName] = codersdk.DERPRegion{ Preferred: node.PreferredDERP == regionID,