Hi,
The fallback mechanism described in the source code of mender client 3.5 does not seem to work correctly with mender-server 2.6:
// getUpdateInfo Tries to get the next update information from the backend. This
// is done in three stages. First it tries a POSTv2 request, then falls back to
// POSTv1, and finally does a GETv1.
The client first tries to POST to /api/devices/v2/deployments/device/deployments/next with a 404 which is normal as we are using open-source version on-prem and we don’t have this endpoint
Then it tries to POST to /api/devices/v1/deployments/device/deployments/next and gets a 405 from the server which makes it stop the fallback process with an error instead of trying to fallback to the third request which should be a GET on /api/devices/v1/deployments/device/deployments.
The culprit seems to be here:
} else if r.StatusCode >= 400 && r.StatusCode < 600 {
log.Debugf("request not accepted by the server: (%s %s): Response code: %d",
req.Method, req.URL.String(), r.StatusCode)
return nil, fmt.Errorf("failed to check update info on the server. Response: %v", r)
}
Which returns an error if we get a HTTP/405 error from the server which is the case with 2.6 release.
Abstract from server logs:
A.B.C.D - - [21/Mar/2023:21:09:57 +0000] "POST /api/devices/v1/deployments/device/deployments/next HTTP/1.1" 405 59 "-" "Go-http-client/1.1" "-" request ID "1c8a949e-68c3-44c8-a2e1-d32f692068e6" 0.010
Logs on the client:
time="2023-03-21T21:49:26Z" level=error msg="Update check failed: transient error: failed to check update info on the server. Response: &{405 Method Not Allowed 405 HTTP/1.1 1 1 map[Connection:[keep-alive] Content-Type:[application/json; charset=utf-8] Date:[Tue, 21 Mar 2023 21:49:26 GMT] Server:[openresty/1.13.6.2] Vary:[Accept-Encoding] X-Deployments-Version:[unknown] X-Men-Requestid:[9caac7bd-ba1b-434c-a225-146ade9da84e]] 0x40004b81c0 -1 [] false true map[] 0x4000104100 <nil>}"
Before I patch the mender-client to handle this more smoothly here, I just wanted to be sure I did not miss something on my side and wanted to know if mender-client 3.x was supposed to work with mender-server 2.6 releases.
Many thanks,
Raph