Error 500 on Members page after invitation sent via API

Summary

After sending the invitation on a project to an email that doesn't have gitlab.com account the Members page shows an error 500. I am using this API: https://docs.gitlab.com/ee/api/invitations.html The API responds successfully and the invitation is correctly sent to the specified email.

Steps to reproduce

curl 
--request POST 
--header "PRIVATE-TOKEN: [API_TOKEN]" 
--data "email=test@example.com&access_level=30&expires_at=2021-01-10" 
--url "https://gitlab.example.com/api/v4/projects/[PROJECT_ID]/invitations"

Example Project

What is the current bug behavior?

Members page shows an error 500 and it's no longer accessible.

What is the expected correct behavior?

Members page should be accessible.

Relevant logs and/or screenshots

Request
:method: GET
:scheme: https
:authority: gitlab.com
:path: [REMOVED]/test-invitation/-/project_members
Cookie: [REMOVED]
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Host: gitlab.com
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0 Safari/605.1.15
Accept-Language: en-us
Referer: https://gitlab.com/[REMOVED]
Connection: keep-alive

Response
:status: 500
Content-Type: text/html; charset=utf-8
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: Tue, 01 Dec 2020 11:58:03 GMT
x-runtime: 0.448284
cf-request-id: 06bfc3c959000014f129aa3000000001
Server: cloudflare
gitlab-sv: web-23-sv-gprd
cf-cache-status: DYNAMIC
expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
x-request-id: 01ERF2NCDVC8H1YMFJF12PJ7VH
gitlab-lb: fe-05-lb-gprd
cf-ray: 5faca255586814f1-MAD

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Results of GitLab application Check

Possible fixes

The API responded successfully and the invitation is correctly sent. After the new user is created and he/she accepts the invitation, the Members page works again.

Edited by Dan Bodnar