# Mender client 3.5 "check update info" does not fallback correctly with mender server 2.6 (at least)

**URL:** <https://hub.mender.io/t/mender-client-3-5-check-update-info-does-not-fallback-correctly-with-mender-server-2-6-at-least/5704>\
**Category:** General Discussions\
**Tags:** mender-client\
**Created:** [March 21, 2023, 10:07pm UTC](https://hub.mender.io/t/mender-client-3-5-check-update-info-does-not-fallback-correctly-with-mender-server-2-6-at-least/5704 "2023-03-21T22:07:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![root42](https://avatars.discourse-cdn.com/v4/letter/r/e480ec/32.png) [@root42](https://hub.mender.io/u/root42)\
**Post date:** [March 21, 2023, 10:07pm UTC](https://hub.mender.io/t/mender-client-3-5-check-update-info-does-not-fallback-correctly-with-mender-server-2-6-at-least/5704/1 "2023-03-21T22:07:40Z")

</div>

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:

> <https://github.com/mendersoftware/mender/blob/3.5.x/client/client_update.go#L91>

```auto
// 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:

> <https://github.com/mendersoftware/mender/blob/405cac1ff1b9d9f6cfe99218c0b58f6958ecc971/client/client_update.go#L153>

```auto
} 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:

```auto
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:

```auto
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
