Skip to content

Commit f5dbc71

Browse files
authored
fix: accept agent RPC connection without version query parameter (#11790)
Fixes an issue where Coder v2.7.1 agents connect to /api/v2/workspaceagents/me/rpc without a version query parameter
1 parent 13beb04 commit f5dbc71

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

coderd/workspaceagentsrpc.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ func (api *API) workspaceAgentRPC(rw http.ResponseWriter, r *http.Request) {
4040

4141
version := r.URL.Query().Get("version")
4242
if version == "" {
43-
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{
44-
Message: "Missing required query parameter: version",
45-
})
46-
return
43+
// The initial version on this HTTP endpoint was 2.0, so assume this version if unspecified.
44+
// Coder v2.7.1 (not to be confused with the Agent API version) calls this endpoint without
45+
// a version parameter and wants Agent API version 2.0.
46+
version = "2.0"
4747
}
4848
if err := proto.CurrentVersion.Validate(version); err != nil {
4949
httpapi.Write(ctx, rw, http.StatusBadRequest, codersdk.Response{

0 commit comments

Comments
 (0)