The invite link was invalid

When a team is created by Gitlab, the invite link was invalid even after invite code regeneration.

Steps to reproduce

Version used
Mattermost Team Edition Version: 6.4.2
Database Schema Version: 6.4.2
Database: postgres
Gitlab version: 14.9.3-ee
Self hosted instance installed with Gitlab Omnibus

How can we reproduce the issue?

  • Go to Gitlab and create a new group
  • Check the box “Create a Mattermost team for this group”
  • Create the group
  • Go to Mattermost and select the new created team
  • Click on invite people and copy the invite link
  • Paste it into a browser

Expected behavior
See the sign up page

Observed behavior
“The invite link was invalid. Please speak with your Administrator to receive an invitation.”