I have a very simple function that checks if a google (workspace) group exists and if not creates it.
This part works perfectly (group is created and I see it in the google admin dashbard) but if the same function is run again (on the now created group) it fails with the very unspecific error: An error occurred while looking up roles in the group: mygroupname@mydomain.at
My best guess was that because the group was created empty it had some problems when accessing the roles but I joined a test group and am still getting the same error.
Here's my simple function:
function createGroupIfNotExists(email)
{
try
{
var group = GroupsApp.getGroupByEmail(email);
console.log(" [i+] Group "+email+" Found!");
}
catch(e)
{
console.log(e)
console.log(" [i-] Group "+email+" Not found.. creating");
var emailObj = {
"email": email,
"name": "Group "+email,
"description": "the new group of "+email
}
var newGroup = AdminDirectory.Groups.insert( emailObj );
}
}