MIT-LCP / physionet-build

The new PhysioNet platform.
https://physionet.org/
BSD 3-Clause "New" or "Revised" License
56 stars 20 forks source link

Maximum length of Google Group names is 73 characters ("Invalid Input: groupName" error) #2008

Open tompollard opened 1 year ago

tompollard commented 1 year ago

When trying to send the MIT datathon dataset to a Google Cloud bucket using the "manage published project" tools in the console, the following error was raised. The problem is that the title of the project is used to set the group name. The maximum length of group names is 73 characters.

Internal Server Error: /console/published-projects/mit-critical-datathon-2023/1.0.0/

HttpError at /console/published-projects/mit-critical-datathon-2023/1.0.0/
<HttpError 400 when requesting https://admin.googleapis.com/admin/directory/v1/groups?alt=json returned "Invalid Input: groupName". Details: "Invalid Input: groupName">
Traceback:

File "./console/views.py" in gcp_bucket_management
 979.         gcp_object = GCP.objects.get(bucket_name=bucket_name)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/db/models/manager.py" in manager_method
 85.                 return getattr(self.get_queryset(), name)(*args, **kwargs)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/db/models/query.py" in get
 650.             raise self.model.DoesNotExist(

During handling of the above exception (GCP matching query does not exist.), another exception occurred:

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/core/handlers/exception.py" in inner
 56.                 response = get_response(request)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/core/handlers/base.py" in _get_response
 197.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
 23.                 return view_func(request, *args, **kwargs)

File "./console/views.py" in manage_published_project
 892.                 gcp_bucket_management(request, project, user)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
 23.                 return view_func(request, *args, **kwargs)

File "./console/views.py" in gcp_bucket_management
 987.             utility.create_bucket(project.slug, project.version, project.title, is_private)

File "./console/utility.py" in create_bucket
 64.         group = create_access_group(bucket, project, version, title)

File "./console/utility.py" in create_access_group
 150.             raise e

File "./console/utility.py" in create_access_group
 132.             creation = service.groups().insert(body={

File "/physionet/python-env/physionet/lib/python3.9/site-packages/googleapiclient/_helpers.py" in positional_wrapper
 134.             return wrapped(*args, **kwargs)

File "/physionet/python-env/physionet/lib/python3.9/site-packages/googleapiclient/http.py" in execute
 915.             raise HttpError(resp, content, uri=self.uri)

Exception Type: HttpError at /console/published-projects/mit-critical-datathon-2023/1.0.0/
Exception Value: <HttpError 400 when requesting https://admin.googleapis.com/admin/directory/v1/groups?alt=json returned "Invalid Input: groupName". Details: "Invalid Input: groupName">

In this case we manually created the google group and added the appropriate permissions (thanks @alistairewj!).

bemoody commented 1 year ago

The Google groups are mostly just an implementation detail. Is the "name"/"description" here visible anywhere? It also occurs to me that project titles might occasionally be changed (though project slugs/versions should never be) and this could cause confusion.

tompollard commented 1 year ago

Is the "name"/"description" here visible anywhere?

The only use I can think of is to help admin users (i.e. people in LCP) to recognise the group in the Google Admin console. It might be more meaningful to use something like: <platformname>-<slug>

bemoody commented 1 year ago

73 characters is also a strange limit. https://developers.google.com/admin-sdk/directory/reference/rest/v1/groups suggests the description is limited to 4096 characters but doesn't say anything about name.

alistairewj commented 1 year ago

Yep, it's super odd, but you can't do it through the front end (https://admin.google.com/ac/groups) either:

Screen Shot 2023-05-24 at 5 39 29 PM
tompollard commented 1 year ago

See also the notes at https://support.google.com/a/answer/9193374 (which I think apply here?).

"Names can be up to 73 characters long."

Perhaps worth avoiding =, <> and & too:

Groups created in the Admin console: Names and descriptions can’t contain equal signs (=), brackets (<>), or ampersands (&).