jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.5k stars 283 forks source link

Editing groups results in 500 errors #3566

Closed KevinAvisi closed 2 months ago

KevinAvisi commented 3 months ago

Description

Noted problem

When trying to update specific groups through Gitbreaker, the response is a 500 error with no message. This could potentially be an issue on GitLab's backend and there is an issue open to them on this topic as well.

The call looks like the following after Gitbreaker sends the call: https://gitlab.com/api/v4/groups/10298240 body: "{"name":"someproject","description":"","visibility":"private","share_with_group_lock":false,"require_two_factor_authentication":false,"two_factor_grace_period":48,"project_creation_level":"developer","auto_devops_enabled":false,"subgroup_creation_level":"maintainer","emails_disabled":false,"mentions_disabled":false,"lfs_enabled":true,"default_branch_protection":2,"request_access_enabled":true,"membership_lock":true}"

And the response as such

name = "GitbeakerRequestError"
stack = "GitbeakerRequestError: Internal Server Error\n at throwFailedRequestError (/Users/kevschom/IdeaProjects/frigg/backend/node_modules/@gitbeaker/rest/dist/index.js:63:9)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async defaultRequestHandler (/Users/kevschom/IdeaProjects/frigg/backend/node_modules/@gitbeaker/rest/dist/index.js:99:7)\n at async /Users/kevschom/IdeaProjects/frigg/backend/node_modules/@gitbeaker/core/dist/index.js:158:22\n at async GitlabApi.editGroup (/Users/kevschom/IdeaProjects/frigg/backend/build/services/GitlabApi.js:145:9)\n at async GitlabService.applyGroupResource (/Users/kevschom/IdeaProjects/frigg/backend/build/services/GitlabService.js:81:21)\n at async Promise.allSettled (index 25)\n at async GitlabService.applyGitlabResources (/Users/kevschom/IdeaProjects/frigg/backend/build/services/GitlabService.js:37:9)\n at async FriggService.apply (/Users/kevschom/IdeaProjects/frigg/backend/build/services/FriggServi"... (length: 1,105)
message = "Internal Server Error"
cause = Object {description: "500 Internal Server Error", request: Request, response: Response}
[[Prototype]] = Error

Steps to reproduce

Try to edit a group through Groups.edit() function (this happens for some groups and not for others and only seems to happen with over 80 group requests).

Expected behaviour

The group edit API request should result in the group being edited (or not if the context was the same)

Actual behaviour

500 response with no message from GitLab

Possible fixes

No clue

Checklist

KevinAvisi commented 3 months ago

I got a response from the GitLab team. It seems to be the case that GitLab no longer supports the attribute emails_disabled on their v4 API from 16.5 onwards. I'd say it's wise to update the GroupSchema model to either include both options or make a breaking version for GitBreaker. https://gitlab.com/gitlab-org/gitlab/-/merge_requests/127899 and also https://docs.gitlab.com/16.10/ee/api/groups.html (search to find emails_disabled). The rest models at the least seem to only support emails_enabled.

I can open an MR if you have no strong opinions to try and resolve the issue

jdalrymple commented 3 months ago

Well thats frustrating haha. Yea Ill do a new release with the min version of the release in the docs. Thanks for the find!

KevinAvisi commented 3 months ago

Small follow-up. They reenabled emails_disabled as it was not supposed to be disabled yet. I still recommend supporting emails_enabled for future cases and making the change. There is now a choice to support both or only emails_enabled going forward. I'd recommend supporting both for the time being as that represent the API from GitLab the best.

jdalrymple commented 2 months ago

:rocket: Issue was released in 40.0.3 :rocket: