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

Service Account fails to create with non-nil error with nil state error #2693

Open
guineveresaenger opened this issue Nov 27, 2024 · 5 comments
Labels
kind/bug Some behavior is incorrect or out of spec

Comments

@guineveresaenger
Copy link
Contributor

guineveresaenger commented Nov 27, 2024

Describe what happened

The service account resource occasionally fails to create with non-nil error with nil state. The account is actually created so further attempts to re-create it cause conflicts. This was reported by users and also affects our tests.

I've come across this particular flake a few times now:
#2683
#2530

but those are just the two issues outlining the exact failure. There could be more where the error wasn't noted. We should investigate.

Sample program

See run output in those links.

Log output

No response

Affected Resource(s)

No response

Output of pulumi about

n/a

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@guineveresaenger guineveresaenger added the kind/bug Some behavior is incorrect or out of spec label Nov 27, 2024
@pulumi-bot pulumi-bot added the needs-triage Needs attention from the triage team label Nov 27, 2024
@guineveresaenger guineveresaenger changed the title Rest Flakes surrounding Serviceaccount resources Test Flakes surrounding Serviceaccount resources Nov 27, 2024
@VenelinMartinov VenelinMartinov removed the needs-triage Needs attention from the triage team label Dec 2, 2024
@wvanderdeijl
Copy link

wvanderdeijl commented Dec 2, 2024

We suffer from this on an almost daily basis since a couple of weeks.
The first attempt to create a service account frequently fails with:

gcp:serviceAccount:Account (*****):
      error: expected non-nil error with nil state during Create of urn:pulumi:***

A retry of the pulumi up than fails with:

    gcp:serviceAccount:Account (*****):
      error: 1 error occurred:
      	* Error creating service account: googleapi: Error 409: Service account sa-**** already exists within project projects/*****.
      Details:
      [
        {
          "@type": "type.googleapis.com/google.rpc.ResourceInfo",
          "resourceName": "projects/*****serviceAccounts/*****@*****.iam.gserviceaccount.com"
        }
      ]
      , alreadyExists

Only remedy we have is to manually delete the service account in GCP and then do a pulumi retry.

It feels like this just started happening one day without us upgrading the pulumi libraries. So it might be related to a server-side change at GCP.

@VenelinMartinov
Copy link
Contributor

Thanks for reporting @wvanderdeijl. Are you also running this in tests or are you seeing these errors in production workflows? I strongly suspect this is indeed GCP API doing something but we might be able to mitigate it.

@wvanderdeijl
Copy link

This is in production workflows. We do multiple deployments a day. Not all run into this issue, but a significant percentage does.

@VenelinMartinov VenelinMartinov changed the title Test Flakes surrounding Serviceaccount resources Service Account fails to create with non-nil error with nil state error Dec 2, 2024
@VenelinMartinov VenelinMartinov added the needs-triage Needs attention from the triage team label Dec 2, 2024
@wvanderdeijl
Copy link

wvanderdeijl commented Dec 3, 2024

This might be version related. I tried with the following simple pulumi (clean) project:

import * as gcp from "@pulumi/gcp";

const prefix = 'a';
for (let i =0; i<=75; i++ ) {
    new gcp.serviceaccount.Account(`${prefix}account${i}`, { accountId: `${prefix}account${i}` });
}

With the freshly installed npm install @pulumi/[email protected] @pulumi/[email protected] I could run this script without issues and update the prefix from a, to b, to c, so effectively running it three times without issues.

But when downgrading to npm install @pulumi/[email protected] @pulumi/[email protected] it failed on the first attempt with 6 service accounts failing with this error.

Not sure if this is concidence. I haven't tested any of the intermediate versions.

@VenelinMartinov
Copy link
Contributor

Interesting, thank you for reporting back @wvanderdeijl. It would be great if this is indeed fixed!

@VenelinMartinov VenelinMartinov removed the needs-triage Needs attention from the triage team label Dec 5, 2024
This was referenced Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

4 participants