# Bug OP-10394 - API v3 Group List Api sometimes misses embedded members field

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-10394

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | High |
| Module |  |
| Target versions | 12.5.5 |
| Observed in versions |  |
| Sprint | 12.5.5 |
| Backlog bucket |  |
| Bug found in version (deprecated) |  |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

Your OpenProject Version: Self hosted 12.1.1 (Docker all in one container)  
Operating System / Browser / OpenProject language: Not a frontend issue, docker container on CENTOS host system, deployed on k8s with extra postgres and memcached container.

### **Logs**

No (useful) log output available.

### **Steps to reproduce:**

We have this problem since the introduction of the group api endpoint and are not able to reproduce it.

### **Actual Behavior**

The list all groups api endpoint `/api/v3/groups` sometimes does not have a `members` attribute under the `_links` section. This problem occurs at an undefined point in time after OpenProject was restarted and persists until one of the following workarounds, breaking again after a next undefined amount of time:

1.  Stop OpenProject. Stop Memcached. Clear Memchached data. Start Memcached. Start OpenProject.
2.  Alternatively, less disturbant in our environment: Flush Memcached for example with `echo 'flush_all' | nc localhost 11211`

The time varies between minutes and days, but often between minutes and less then 48 hours.

For example the following output is produced, for the `Mustergroup`, no `members` field is present

```json
{
	"_type": "Collection",
	"total": 427,
	"count": 427,
	"pageSize": 500,
	"offset": 1,
	"_embedded": {
        "elements": [
            ...,
			{
				"_type": "Group",
				"id": 19,
				"name": "Mustergruppe",
				"createdAt": "2020-09-26T21:02:00Z",
				"updatedAt": "2022-05-07T01:47:41Z",
				"_links": {
					"self": {
						"href": "/api/v3/groups/19",
						"title": "mustergruppe"
					},
					"memberships": {
						"href": "/api/v3/memberships?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%2219%22%5D%7D%7D%5D",
						"title": "Mitglieder"
					},
					"delete": {
						"href": "/api/v3/groups/19",
						"method": "delete"
					},
					"updateImmediately": {
						"href": "/api/v3/groups/19",
						"method": "patch"
					}
				}
			},
            ...],
        },
	"_links": {
		"self": {
			"href": "/api/v3/groups?filters=%5B%5D&offset=1&pageSize=500"
		},
		"jumpTo": {
			"href": "/api/v3/groups?filters=%5B%5D&offset=%7Boffset%7D&pageSize=500",
			"templated": true
		},
		"changeSize": {
			"href": "/api/v3/groups?filters=%5B%5D&offset=1&pageSize=%7Bsize%7D",
			"templated": true
		}
	}
}
```

### **Expected Behavior**

The following output is expected. It is also retrieved by calling the group api endpoint with the specific group id:

```json
{
	"_embedded": {
		"members": [
			{
				"_type": "User",
				"id": 44,
				"name": "Maximilian Mustermann",
				"createdAt": "2020-10-05T07:21:43Z",
				"updatedAt": "2022-05-06T08:54:38Z",
				"login": "max.mustermann",
				"admin": false,
				"firstName": "Maximilian",
				"lastName": "Mustermann",
				"email": "max.mustermann@example.org",
				"avatar": "",
				"status": "active",
				"identityUrl": null,
				"language": "de",
				"_links": {
					"self": {
						"href": "/api/v3/users/44",
						"title": "Maximilian Mustermann"
					},
					"memberships": {
						"href": "/api/v3/memberships?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%2244%22%5D%7D%7D%5D",
						"title": "Mitglieder"
					},
					"showUser": {
						"href": "/users/44",
						"type": "text/html"
					},
					"updateImmediately": {
						"href": "/api/v3/users/44",
						"title": "Update max.mustermann",
						"method": "patch"
					},
					"lock": {
						"href": "/api/v3/users/44/lock",
						"title": "Set lock on max.mustermann",
						"method": "post"
					},
					"delete": {
						"href": "/api/v3/users/44",
						"title": "Delete max.mustermann",
						"method": "delete"
					},
					"auth_source": {
						"href": "/api/v3/auth_sources/1",
						"title": "dkp"
					}
				}
			},
			{
				"_type": "User",
				"id": 869,
				"name": "Erika Musterfrau",
				"createdAt": "2021-08-02T12:58:26Z",
				"updatedAt": "2022-05-06T06:07:27Z",
				"login": "erika.musterfrau",
				"admin": false,
				"firstName": "Erika",
				"lastName": "Musterfrau",
				"email": "erika.musterfrau@example.org",
				"avatar": "",
				"status": "active",
				"identityUrl": null,
				"language": "",
				"_links": {
					"self": {
						"href": "/api/v3/users/869",
						"title": "Erika Musterfrau"
					},
					"memberships": {
						"href": "/api/v3/memberships?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%22869%22%5D%7D%7D%5D",
						"title": "Mitglieder"
					},
					"showUser": {
						"href": "/users/869",
						"type": "text/html"
					},
					"updateImmediately": {
						"href": "/api/v3/users/869",
						"title": "Update erika.musterfrau",
						"method": "patch"
					},
					"lock": {
						"href": "/api/v3/users/869/lock",
						"title": "Set lock on erika.musterfrau",
						"method": "post"
					},
					"delete": {
						"href": "/api/v3/users/869",
						"title": "Delete erika.musterfrau",
						"method": "delete"
					},
					"auth_source": {
						"href": "/api/v3/auth_sources/1",
						"title": "dkp"
					}
				}
			}
		]
	},
	"_type": "Group",
	"id": 19,
	"name": "Mustergruppe",
	"createdAt": "2020-09-26T21:02:00Z",
	"updatedAt": "2022-05-07T01:47:41Z",
	"_links": {
		"self": {
			"href": "/api/v3/groups/19",
			"title": "mustergruppe"
		},
		"memberships": {
			"href": "/api/v3/memberships?filters=%5B%7B%22principal%22%3A%7B%22operator%22%3A%22%3D%22%2C%22values%22%3A%5B%2219%22%5D%7D%7D%5D",
			"title": "Mitglieder"
		},
		"delete": {
			"href": "/api/v3/groups/19",
			"method": "delete"
		},
		"updateImmediately": {
			"href": "/api/v3/groups/19",
			"method": "patch"
		}
	}
}
```
