Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"failed to add assignee (Cannot read properties of undefined (reading 'id'))" on Gitlab self-hosted #27943

Open
rarkins opened this issue Mar 14, 2024 Discussed in #27890 · 1 comment
Labels
platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@rarkins
Copy link
Collaborator

rarkins commented Mar 14, 2024

Discussed in #27890

Originally posted by deronnax March 12, 2024

What would you like help with?

I think I found a bug

How are you running Renovate?

Self-hosted

If you're self-hosting Renovate, tell us which platform (GitHub, GitLab, etc) and which version of Renovate.

Gitlab

Please tell us more about your question or problem

Hello.
I run renovate on one of our repo, and on this repository, renovate has an assignee problem: it fails to add assignees to an MR (see logs).
I won't be able to do a minimum reproducible use case, but maybe we can work something else.
I am pretty sure it did work when using reviewers instead of assignees.
Thank you very much.

Logs (if relevant)

Logs

DEBUG: Adding assignees 'orga/core/squad-honeytoken' to #11290 (repository=gg-code/prm/ward-runs-app, branch=renovate/python-gitlab-4.x)
DEBUG: addAssignees error (repository=gg-code/prm/ward-runs-app, branch=renovate/python-gitlab-4.x)
       "err": {
         "message": "Cannot read properties of undefined (reading 'id')",
         "stack": "TypeError: Cannot read properties of undefined (reading 'id')\n    at getUserID (/usr/local/renovate/lib/modules/platform/gitlab/http.ts:10:13)\n    at processTicksAndRejections (node:internal/process/task_queues:95:5)\n    at Proxy.addAssignees (/usr/local/renovate/lib/modules/platform/gitlab/index.ts:1196:24)\n    at addParticipants (/usr/local/renovate/lib/workers/repository/update/pr/participants.ts:61:11)\n    at ensurePr (/usr/local/renovate/lib/workers/repository/update/pr/index.ts:501:9)\n    at processBranch (/usr/local/renovate/lib/workers/repository/update/branch/index.ts:753:28)\n    at writeUpdates (/usr/local/renovate/lib/workers/repository/process/write.ts:166:17)\n    at update (/usr/local/renovate/lib/workers/repository/process/extract-update.ts:214:11)\n    at Object.renovateRepository (/usr/local/renovate/lib/workers/repository/index.ts:77:19)\n    at attributes.repository (/usr/local/renovate/lib/workers/global/index.ts:200:11)\n    at start (/usr/local/renovate/lib/workers/global/index.ts:185:7)\n    at /usr/local/renovate/lib/renovate.ts:18:22"
       }
 WARN: Failed to add assignees (repository=gg-code/prm/ward-runs-app, branch=renovate/python-gitlab-4.x)
@rarkins rarkins added type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others platform:gitlab GitLab Platform labels Mar 14, 2024
@rarkins
Copy link
Collaborator Author

rarkins commented Mar 15, 2024

This code needs to be refactored to be defensive:

export async function getUserID(username: string): Promise<number> {
return (
await gitlabApi.getJson<{ id: number }[]>(`users?username=${username}`)
).body[0].id;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:gitlab GitLab Platform priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

No branches or pull requests

1 participant