Missing 'memberKey' for some users but not others

55 views
Skip to first unread message

Wes Hall

unread,
Mar 25, 2025, 11:15:36 AMMar 25
to GAM for Google Workspace
I was trying to update the delivery options for a user and was unable to do so with the following:

gam update group <group_name> update delivery digest user <user1>

I received the error "Missing required field: memberKey".

I was finally able to successfully update the delivery using user uid:<uid>

I tried again with a different user and was able to update user2 with the same command that failed with user1.  What is different between those two accounts and how would I discover it/resolve it?

Thanks,
Wes

Debug below:
connect: (admin.googleapis.com, 443)
send: b'GET /$discovery/rest?version=directory_v1 HTTP/1.1\r\nHost: admin.googleapis.com\r\ncontent-length: 0\r\nuser-agent: GAM 7.00.32 - https://github.com/GAM-team/GAM / GAM Team <google-ap...@googlegroups.com> / Python 3.13.0 final / macOS-14.4.1-x86_64-i386-64bit-Mach-O x86_64 /\r\nx-goog-api-client: cred-type/u\r\nauthorization: Bearer ***\r\naccept-encoding: gzip, deflate\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: Content-Type: application/json; charset=UTF-8
header: Vary: Origin
header: Vary: X-Origin
header: Vary: Referer
header: Content-Encoding: gzip
header: Date: Tue, 25 Mar 2025 15:01:56 GMT
header: Server: ESF
header: X-XSS-Protection: 0
header: X-Frame-Options: SAMEORIGIN
header: X-Content-Type-Options: nosniff
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Transfer-Encoding: chunked
send: b'GET /admin/directory/v1/groups/<group>%40collegedaleacademy.com?fields=email&prettyPrint=true&alt=json HTTP/1.1\r\nHost: admin.googleapis.com\r\naccept: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: GAM 7.00.32 - https://github.com/GAM-team/GAM / GAM Team <google-ap...@googlegroups.com> / Python 3.13.0 final / macOS-14.4.1-x86_64-i386-64bit-Mach-O x86_64 / (gzip)\r\nx-goog-api-client: gdcl/2.146.0 gl-python/3.13.0 cred-type/u\r\ncontent-length: 0\r\nauthorization: Bearer ***\r\n\r\n'
reply: 'HTTP/1.1 200 OK\r\n'
header: ETag: "***"
header: Content-Type: application/json; charset=UTF-8
header: Vary: Origin
header: Vary: X-Origin
header: Vary: Referer
header: Content-Encoding: gzip
header: Date: Tue, 25 Mar 2025 15:01:56 GMT
header: Server: ESF
header: X-XSS-Protection: 0
header: X-Frame-Options: SAMEORIGIN
header: X-Content-Type-Options: nosniff
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Transfer-Encoding: chunked
Group: <group>@collegedaleacademy.com, Update 1 Member
send: b'PATCH /admin/directory/v1/groups/<group>%40collegedaleacademy.com/members/<user1>%40collegedaleacademy.com?fields=&prettyPrint=true&alt=json HTTP/1.1\r\nHost: admin.googleapis.com\r\naccept: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: GAM 7.00.32 - https://github.com/GAM-team/GAM / GAM Team <google-ap...@googlegroups.com> / Python 3.13.0 final / macOS-14.4.1-x86_64-i386-64bit-Mach-O x86_64 / (gzip)\r\nx-goog-api-client: gdcl/2.146.0 gl-python/3.13.0 cred-type/u\r\ncontent-type: application/json\r\ncontent-length: 31\r\nauthorization: Bearer ***\r\n\r\n'
send: b'{"delivery_settings": "DIGEST"}'
reply: 'HTTP/1.1 400 Bad Request\r\n'
header: Vary: Origin
header: Content-Type: application/json; charset=UTF-8
header: Vary: X-Origin
header: Vary: Referer
header: Content-Encoding: gzip
header: Date: Tue, 25 Mar 2025 15:01:56 GMT
header: Server: ESF
header: X-XSS-Protection: 0
header: X-Frame-Options: SAMEORIGIN
header: X-Content-Type-Options: nosniff
header: Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
header: Transfer-Encoding: chunked
ERROR:  JSON: {'error': {'code': 400, 'message': 'Missing required field: memberKey', 'errors': [{'message': 'Missing required field: memberKey', 'domain': 'global', 'reason': 'required'}]}}
  Group: <group>@collegedaleacademy.com, Member: <user>@collegedaleacademy.com, Role Update Failed: Missing required field: memberKey

Ross Scroggs

unread,
Mar 25, 2025, 11:18:16 AMMar 25
to google-ap...@googlegroups.com
Was user1 external to your domain? Google has a problem with some external email addresses where you have to user the uid.

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/10d0b720-f618-469e-9ec7-55e708267682n%40googlegroups.com.

Wes Hall

unread,
Mar 25, 2025, 12:16:29 PMMar 25
to GAM for Google Workspace
Nope.  Both users are internal.  FWIW, I tried with the primaryEmail as well as the username with no change.

Is the primaryEmail and full group name an assumption by GAM or a value returned from the first requests in the command chain? 

(def_python) wes@*** ~ % gam update group <group> update delivery allmail user <user1>

Group: <group>@collegedaleacademy.com, Update 1 Member
  Group: <group>@collegedaleacademy.com, Member: <user1>@collegedaleacademy.com, Role Update Failed: Missing required field: memberKey

failed patch:
send: b'PATCH /admin/directory/v1/groups/<group>%40collegedaleacademy.com/members/<user1>%40collegedaleacademy.com?fields=&prettyPrint=true&alt=json HTTP/1.1\r\nHost: admin.googleapis.com\r\naccept: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: GAM 7.00.32 - https://github.com/GAM-team/GAM / GAM Team <google-ap...@googlegroups.com> / Python 3.13.0 final / macOS-14.4.1-x86_64-i386-64bit-Mach-O x86_64 / (gzip)\r\nx-goog-api-client: gdcl/2.146.0 gl-python/3.13.0 cred-type/u\r\ncontent-type: application/json\r\ncontent-length: 31\r\nauthorization: Bearer ***\r\n\r\n'
send: b'{"delivery_settings": "DIGEST"}'

successful patch:
send: b'PATCH /admin/directory/v1/groups/<group>%40collegedaleacademy.com/members/<user2>%40collegedaleacademy.com?fields=&prettyPrint=true&alt=json HTTP/1.1\r\nHost: admin.googleapis.com\r\naccept: application/json\r\naccept-encoding: gzip, deflate\r\nuser-agent: GAM 7.00.32 - https://github.com/GAM-team/GAM / GAM Team <google-ap...@googlegroups.com> / Python 3.13.0 final / macOS-14.4.1-x86_64-i386-64bit-Mach-O x86_64 / (gzip)\r\nx-goog-api-client: gdcl/2.146.0 gl-python/3.13.0 cred-type/u\r\ncontent-type: application/json\r\ncontent-length: 33\r\nauthorization: Bearer ***\r\n\r\n'
send: b'{"delivery_settings": "ALL_MAIL"}'

Issuing a gam info user <user> returns the following for the two users:

User: h*k*@collegedaleacademy.com                   User: j*l*@collegedaleacademy.com
  Settings:                                             Settings:
    First Name: K*                                        First Name: L*
    Last Name: H*                                         Last Name: J*
    Full Name: K* H*                                      Full Name: L* J*
    Languages: en+                                        Languages: en+
    Is a Super Admin: False                               Is a Super Admin: False
    Is Delegated Admin: False                             Is Delegated Admin: False
    2-step enrolled: False                                2-step enrolled: False
    2-step enforced: False                                2-step enforced: False
    Has Agreed to Terms: True                             Has Agreed to Terms: True
    IP Whitelisted: False                                 IP Whitelisted: False
    Account Suspended: False                              Account Suspended: False
    Is Archived: False                                    Is Archived: False
    Must Change Password: False                           Must Change Password: False
    Google Unique ID: 1***2                               Google Unique ID: 1***0
    Customer ID: C***                                     Customer ID: C***
    Mailbox is setup: True                                Mailbox is setup: True
    Included in GAL: True                                 Included in GAL: True
    Creation Time: 2023-06-20T15:45:10-04:00              Creation Time: 2023-06-20T15:45:59-04:00
    Last login time: 2025-03-24T14:24:24-04:00            Last login time: 2025-03-25T08:55:31-04:00
    Google Org Unit Path: /C.A. Students/<ou>             Google Org Unit Path: /C.A. Students/<ou>
  Custom Schemas:                                       Custom Schemas:
    Schema: SD                                            Schema: SD
      StudentID: 1*1.                                       StudentID: 1*5
  Groups: (2)                                           Groups: (1)
    <group>: <group>@collegedaleacademy.com               <group>: <group>@collegedaleacademy.com
    _test_class: _test_***@collegedaleacademy.com          



Wes Hall

unread,
Mar 25, 2025, 2:20:08 PMMar 25
to GAM for Google Workspace
Many thanks to Ross for discovering a typo that I missed _repeatedly_ while sanitizing the output.

Make sane usernames!!!!!!
Wes
Reply all
Reply to author
Forward
0 new messages