We have a salesforce lightning community. When guest users agree to register in one of the community pages(clicking a checkbox), the underlying code creates an account, a community user, public group, apex share and add the user to the public group as a group member. The code updates the account record with the related public group id and finally sends out an verification email to the user. All of these actions occur as a guest user. With summer 20 changes to guest user profile, guest user profile cannot create group or group member and can only create/read (not edit) objects. Hence our code has started failing in sandbox at the point of group creation with the following error.
Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, AccountTrigger: execution of AfterInsert caused by: System.DmlException: Insert failed. First exception on row 0; first error: UNKNOWN_EXCEPTION
Any ideas how to fix it.