Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Resource Not Found: groupKey" randomly appears #166

Closed
IonicaBizau opened this issue Apr 2, 2014 · 12 comments
Closed

"Resource Not Found: groupKey" randomly appears #166

IonicaBizau opened this issue Apr 2, 2014 · 12 comments
Assignees
Labels
🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@IonicaBizau
Copy link
Contributor

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!

@IonicaBizau
Copy link
Contributor Author

Temporary fixed adding some timeouts, but it's not an elegant solution...

@IonicaBizau
Copy link
Contributor Author

@rakyll Any progress on this?

@ryanseys
Copy link
Contributor

This looks like a race condition that's happening at the API level, not at our client level. Specifically at TEST 4

-------- 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

Seems the group is created with the id groupKey, then member insertion fails because the API fails to see the new group. Member remove fails subsequently because it was never inserted in the first place, and then group deletion works because the API finally sees the new group.

@IonicaBizau
Copy link
Contributor Author

This looks like a race condition that's happening at the API level, not at our client level.

Will devs fix this?

@ryanseys
Copy link
Contributor

Bug filed internally. b/16196229

@IonicaBizau
Copy link
Contributor Author

Thanks!

@ryanseys
Copy link
Contributor

@IonicaBizau Wish I had a better response than this but they replied to the internal bug saying 'Won't Fix (Intended Behavior)' with a reason related to their architecture choice. Hopefully this issue will eventually resolve itself internally but for now I am closing this issue as it's technically unrelated to this API client.

@IonicaBizau
Copy link
Contributor Author

Thanks for feedback. The workaround I found is to set some timeouts (~4000ms) to be sure that the API did its job.

@alfasin
Copy link

alfasin commented 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!

@IonicaBizau
Copy link
Contributor Author

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

@alfasin
Copy link

alfasin commented May 3, 2015

@IonicaBizau that's also the fastest way to let your customers know you don't give a sh*t about them. It's very unfortunate that a company like Google shows this kind of unprofessional attitude...

@IonicaBizau
Copy link
Contributor Author

Well, let's hope the time will fix it. 😄 Probably they try to keep the issues clean.

@ghost ghost deleted a comment Jul 16, 2019
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants