question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Resource Not Found: groupKey" randomly appears

See original GitHub issue

I have a script that:

  1. Creates a new group
  2. Adds a member to that group
  3. Removes the member from that group
  4. Deletes the group
  5. Continue with step 1

The code is:

// Authentication via JWT
...
var testGroup = "johnny-test@jillix.com"
  , emailToAdd = "bizauionica@yahoo.com"
  , k = 0
  ;

(function foo () {

    console.log("-------- TEST " + (++k) + " --------------");
    // group insert
    client.admin.groups.insert({
        email: testGroup
    }).execute(function (err, data) {

        console.log("Group create: ", err || data);
        // member insert
        client.admin.members.insert({
            groupKey: testGroup
        }, {
            email: emailToAdd
        }).execute(function (err, data) {

            console.log("Member insert", err || data);

            // member delete
            client.admin.members.delete({
                groupKey: testGroup
              , memberKey: emailToAdd
            }).execute(function (err, data) {
                console.log("Member remove", err || data);

                // group delete
                client.admin.groups.delete({
                    groupKey: testGroup
                }).execute(function (err, data) {
                    console.log("Group remove", err || data);
                    foo();
                });
            });
        });
    });
})()
...

Sometimes the Resource Not Found: groupKey error appears. I suppose that the group is not yet created and the member add request is run. How can I solve this?

The output of the script is:

-------- TEST 1 --------------
Group create:  { errors: 
   [ { domain: 'global',
       reason: 'duplicate',
       message: 'Entity already exists.' } ],
  code: 409,
  message: 'Entity already exists.' }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 2 --------------
Group create:  { kind: 'admin#directory#group',
  id: '03o7alnk441n1np',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/JKrfOps9z8-vupenUPMMdOhJKPg"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 3 --------------
Group create:  { kind: 'admin#directory#group',
  id: '0279ka653b9rvvn',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/YBgVLGVcZ6tdkPuc-5IUkE8X05o"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 4 --------------
Group create:  { kind: 'admin#directory#group',
  id: '03tbugp118bejev',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/Siz_CPzNREhf4MGin9AJq_VZrLc"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 5 --------------
Group create:  { kind: 'admin#directory#group',
  id: '048pi1tg3gm9un2',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/r5nsQPCQmcwk9lUQOZ2GTNiXZPE"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 6 --------------
Group create:  { kind: 'admin#directory#group',
  id: '02lwamvv11s6mg1',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/eAl4dE-UPwdVkzy8BqRXlXdR0YQ"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 7 --------------
Group create:  { kind: 'admin#directory#group',
  id: '0184mhaj48dzd5k',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/oylcdbftOAkzLCZpKByy242ilIM"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 8 --------------
Group create:  { kind: 'admin#directory#group',
  id: '01ljsd9k1af4qm1',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/yJ3gt__XCVUhb8u86UAyo3u4czg"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 9 --------------
Group create:  { kind: 'admin#directory#group',
  id: '00gjdgxs2los8l8',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/4T5RsXeuCvgAstmfn0_qFuDjqVg"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 10 --------------
Group create:  { kind: 'admin#directory#group',
  id: '02w5ecyt4altqa7',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/wag6MJmfhnNhHEVk56qrBcepm3g"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 11 --------------
Group create:  { kind: 'admin#directory#group',
  id: '030j0zll0gjf6ad',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/TZAhihNRAdg22j3Q0v_vcBgOEqY"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 12 --------------
Group create:  { kind: 'admin#directory#group',
  id: '039kk8xu1xc7orv',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/8cz7c02KSGvLf4STOsyf2ECj53A"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 13 --------------
Group create:  { kind: 'admin#directory#group',
  id: '0206ipza46ltn2o',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/X0mKZCQggXKKo2g47QCfe8MqbFA"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
-------- TEST 14 --------------
Group create:  { errors: 
   [ { domain: 'global',
       reason: 'duplicate',
       message: 'Entity already exists.' } ],
  code: 409,
  message: 'Entity already exists.' }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 15 --------------
Group create:  { kind: 'admin#directory#group',
  id: '02afmg282f4pg7v',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/5PTQNzkG_UZ4f4eO9b6IkosJ2VM"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined
-------- TEST 16 --------------
Group create:  { kind: 'admin#directory#group',
  id: '04h042r01wv6svp',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/aPbOI_qXAA_TqrAk2SbkqlWWWxQ"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Group remove undefined
-------- TEST 17 --------------
Group create:  { kind: 'admin#directory#group',
  id: '01d96cc01cztl7q',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/rizaxgZ2v2PYLcdW5xiltVenpb0"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: groupKey' } ],
  code: 404,
  message: 'Resource Not Found: groupKey' }
Member remove { errors: 
   [ { domain: 'global',
       reason: 'notFound',
       message: 'Resource Not Found: memberKey' } ],
  code: 404,
  message: 'Resource Not Found: memberKey' }
Group remove undefined
-------- TEST 18 --------------
Group create:  { kind: 'admin#directory#group',
  id: '03j2qqm339mfz41',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/C84QWOuIBW0GTXKzSfpPGZ3Z5JA"',
  email: 'johnny-test@jillix.com',
  name: 'johnny-test',
  description: '',
  adminCreated: true }
Member insert { kind: 'admin#directory#member',
  etag: '"KbzxxlrznavcDE7kirZiCFvGH0s/88eFsAOwd57HlxafEY8Mz1oFMaE"',
  id: '109274325672508858588',
  email: 'bizauionica@yahoo.com',
  role: 'MEMBER',
  type: 'USER' }
Member remove undefined
Group remove undefined

@rakyll Any idea? Thanks!

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:12 (10 by maintainers)

github_iconTop GitHub Comments

7reactions
alfasincommented, Mar 14, 2015

That’s why I LOVE Google APIs: not only friendly error messages and great documentations - but they also fix their bugs very quickly. Go Google!

2reactions
IonicaBizaucommented, Mar 14, 2015

@alfasin WONTFIX or That’s the intended behavior are two fast ways to fix bugs. 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

“Resource Not Found: GroupKey” Randomly Appears
I run into this with Dito GAM[1] when handling groups/calendar access. I workaround by just making it try three times.
Read more >
API call to directory.members.insert failed with error: ...
The Google Group seems to be found and the Google Group's email/groupKey is returned correctly. The currentUser in the session (me) is a...
Read more >
Failed to update group [GROUP NAME]. Resource Not Found
Overview. When pushing groups to G Suite via aPush Groups, this error may come up "Changes to the Group push mapping for the...
Read more >
Password-based Group Key Exchange in a Constant ...
first provably-secure password-based constant-round group key exchange protocol. ... We however enhance it with the Real-or-Random no-.
Read more >
Adafruit IO MQTT API
Use a unique value such as a random GUID. ... We do not currently limit the number of clients that can connect to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found