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

Error object is empty breaking action #395

Closed
GrahamCampbell opened this issue Feb 26, 2022 · 29 comments
Closed

Error object is empty breaking action #395

GrahamCampbell opened this issue Feb 26, 2022 · 29 comments
Labels
bug Something isn't working effort/medium This issue will take a few days of effort to fix p2 response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days.

Comments

@GrahamCampbell
Copy link
Contributor

Action stopped working today, after working for multiple weeks:

    runs-on: ubuntu-20.04

    steps:
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          role-to-assume: arn:aws:iam::[REDACTED]:role/[REDACTED]
          role-duration-seconds: 3600
          aws-region: us-east-1
Error: Error message: Cannot read property 'message' of undefined
@GrahamCampbell
Copy link
Contributor Author

GrahamCampbell commented Feb 27, 2022

Seems to be kinda temperamental. Is working again now.

@sihil
Copy link

sihil commented Feb 28, 2022

I've also seen this happen a couple of times today but not consistently. A search (https://github.com/aws-actions/configure-aws-credentials/search?q=message) indicates that this could be an error masking another error?

Edit: Also seeing this when assuming a role via OIDC.

@mmuth
Copy link

mmuth commented Mar 1, 2022

Same problem here... do you have any ideas where to dig into the source.. oder what to do to make it more stable or get closer to the cause of the problem?

mmuth added a commit to meisterplan/configure-aws-credentials that referenced this issue Mar 1, 2022
- insights absolutely missing...
- actions fails sporadically with a
  "message not found" error
- currently watching aws-actions#395
- also fix a bug in the unit test
  (guess it was changed but not executed
  some time...)

KNUTH-66633
mmuth added a commit to meisterplan/configure-aws-credentials that referenced this issue Mar 2, 2022
- insights absolutely missing...
- actions fails sporadically with a
  "message not found" error
- currently watching aws-actions#395
- also fix a bug in the unit test
  (guess it was changed but not executed
  some time...)

KNUTH-66633
@jonas-pietzsch
Copy link

We're observing same flaky behaviour as of today (assuming role via OIDC). Currently we can't locate the problem and think that it's belonging to the runners - we're using default runners. One run fails, the next one again works. Very strange.

@WtfJoke
Copy link

WtfJoke commented Mar 11, 2022

Wild guessing here, but I noticed that while adding Github as OIDC provider in AWS, that I get different SSL Certificate thumbprints, such as:

  • 6938fd4d98bab03faadb97b34396831e3780aea1 (seems like the most current one, according to github's blog post and the example in the configure-aws-credentials action's README)
  • 15e29108718111e59b3dad31954647e3c344a231 (aws calculated that thumbprint when I created the github oidc provider on 22.02.22)
  • a031c46782e6e6c662c2c87c76da9aa62ccabd8e (seems to be an older one)

There is also an open issue here #357 (but the error message compared to that issue is more on point)

TLDR: You might should take a look at your thumbprint and add 693... to the list, if its not already there.

@peterwoodworth peterwoodworth added the needs-triage This issue still needs to be triaged label Oct 1, 2022
@peterwoodworth peterwoodworth changed the title Action broken Error object is empty breaking action Oct 5, 2022
@peterwoodworth
Copy link
Contributor

The issue described here must be intermittent. message is a property we reference on the error objects when trying various things while running this action. So these objects are sometimes empty for some reason. Doesn't seem to be affecting many people consistently, if you do run into this in the future please comment on how you are trying to assume the role (e.g. OIDC or access keys)

@peterwoodworth peterwoodworth added bug Something isn't working needs-reproduction This issue needs reproduction. p2 and removed needs-triage This issue still needs to be triaged labels Oct 5, 2022
@matthieudolci
Copy link

We are also having this flaky behaviour while assuming roles with OIDC

@pete-fl0
Copy link

Experiencing flaky behaviour assuming role via OIDC.
Using thumbprint 6938fd4d98bab03faadb97b34396831e3780aea1

@peterwoodworth
Copy link
Contributor

I'm going to also request that people share their full workflow files if possible. It seems this is limited to OIDC which is helpful to know 🙂

@egglestonbd
Copy link

We are having a similar experience, using aws-actions/configure-aws-credentials@v1-node16:

Error: Error message: Cannot read properties of undefined (reading 'message')

Cleaned log:

Run aws-actions/configure-aws-credentials@v1-node16
  with:
    role-to-assume: arn:aws:iam::***:role/some/path/some-role-1MSY53MY098H2
    aws-region: us-east-1
    role-duration-seconds: 900
    audience: sts.amazonaws.com
  env:
    AWS_DEFAULT_REGION: us-east-1
    AWS_REGION: us-east-1
    AWS_ACCESS_KEY_ID: ***
    AWS_SECRET_ACCESS_KEY: ***
    AWS_SESSION_TOKEN: ***
    ... other env vars

@stayman-coastpay
Copy link

We are also seeing it using oidc

@bskiff
Copy link

bskiff commented Jan 19, 2023

We're also getting intermittent failures with OIDC. It's working the majority of the time though. I don't see any logs in AWS CloudTrail for an attempted OIDC login around the time of the error.

Workflow:

- name: Configure AWS Credentials
  uses: aws-actions/[email protected]
  with:
    role-to-assume: // our IAM role ARN 
    aws-region: // our AWS region

Output:

Run aws-actions/[email protected]
with:
  role-to-assume: // our IAM role ARN 
  aws-region: // AWS region
  audience: sts.amazonaws.com
env:
  ...
Error: Error message: Cannot read property 'message' of undefined  

@sayhiben
Copy link

I also encountered this today in a workflow that has many parallel jobs that independently authed with AWS successfully - just the one job failed. I suspect that something is being raised in run() that doesn't produce a typical Error object.

I haven't any information on where this is being thrown from, but have enabled ACTIONS_STEP_DEBUG in case I can catch it again.

In the meantime, perhaps the team can change the catch-all core.setFailed(error.message) call to core.setFailed(error.toString()) so that the stack trace is emitted.. Alternatively, it could be called with an Error object, since actions/toolkit/core internally calls error.toString() anyway.

Here's my unhelpful log :)

2023-02-13T19:43:12.0069544Z ##[group]Run <ORG-NAME>/<PRIVATE-CUSTOM-ACTION-FOR-AWS-AUTH>@v1
2023-02-13T19:43:12.0069850Z with:
2023-02-13T19:43:12.0070072Z   role-to-assume: <ROLE>
2023-02-13T19:43:12.0070295Z   account-name: <ACCOUNT-NAME>
2023-02-13T19:43:12.0070501Z   aws-region: <ACCOUNT-REGION>
2023-02-13T19:43:12.0070722Z   mask-aws-account-id: false
2023-02-13T19:43:12.0070934Z ##[endgroup]
2023-02-13T19:43:12.0301300Z ##[group]Run /home/runner/work/_actions/<ORG-NAME>/<PRIVATE-CUSTOM-ACTION-FOR-AWS-AUTH>/v1/configure.sh
2023-02-13T19:43:12.0301829Z �[36;1m/home/runner/work/_actions/<ORG-NAME>/<PRIVATE-CUSTOM-ACTION-FOR-AWS-AUTH>/v1/configure.sh�[0m
2023-02-13T19:43:12.0350726Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-02-13T19:43:12.0350996Z env:
2023-02-13T19:43:12.0351201Z   ROLE: <ROLE>
2023-02-13T19:43:12.0351424Z   ACCOUNT_NAME: <ACCOUNT-NAME>
2023-02-13T19:43:12.0351619Z ##[endgroup]
2023-02-13T19:43:12.0588288Z ##[group]Run aws-actions/configure-aws-credentials@v1-node16
2023-02-13T19:43:12.0588664Z with:
2023-02-13T19:43:12.0588951Z   role-to-assume: arn:aws:iam::<ACCOUNT-ID>:role/<ROLE>
2023-02-13T19:43:12.0589401Z   aws-region: <ACCOUNT-REGION>
2023-02-13T19:43:12.0589623Z   mask-aws-account-id: false
2023-02-13T19:43:12.0589849Z   audience: sts.amazonaws.com
2023-02-13T19:43:12.0590057Z ##[endgroup]
2023-02-13T19:43:12.2587488Z ##[error]Error message: Cannot read properties of undefined (reading 'message')

@peterwoodworth peterwoodworth added effort/small This issue will take less than a day of effort to fix and removed needs-reproduction This issue needs reproduction. labels Feb 22, 2023
foxylion pushed a commit to meisterplan/configure-aws-credentials that referenced this issue Jun 20, 2023
- insights absolutely missing...
- actions fails sporadically with a
  "message not found" error
- currently watching aws-actions#395
- also fix a bug in the unit test
  (guess it was changed but not executed
  some time...)

KNUTH-66633
@lkeijmel
Copy link

lkeijmel commented Jun 21, 2023

Hi, we are also experiencing this issue and enabled the SHOW_STACK_TRACE but it only points out that the error is undefined somehow:

Error: Error message: Cannot read properties of undefined (reading 'message')
/home/runner/work/_actions/aws-actions/configure-aws-credentials/v2/dist/index.js:585
                throw new Error(`Error message: ${error.message}`);

After examining the code it seems to be thrown in the getIDToken within the OIDC client:

static getIDToken(audience) {
        return __awaiter(this, void 0, void 0, function* () {
            try {
                // New ID Token is requested from action service
                let id_token_url = OidcClient.getIDTokenUrl();
                if (audience) {
                    const encodedAudience = encodeURIComponent(audience);
                    id_token_url = `${id_token_url}&audience=${encodedAudience}`;
                }
                core_1.debug(`ID token url is ${id_token_url}`);
                const id_token = yield OidcClient.getCall(id_token_url);
                core_1.setSecret(id_token);
                return id_token;
            }
            catch (error) {
                throw new Error(`Error message: ${error.message}`); <------ ERROR IS THROWN HERE
            }
        });
    }

@lkeijmel
Copy link

I've opened an issue on the Github toolkit where the OIDC client is defined

@alexef
Copy link

alexef commented Jun 21, 2023

We have the same issue, with oidc and self hosted runners. Every time we restart the failed workflow, it works.
Can it be that idle runners get into a broken state somehow (expired github_token ??) and the token exchange over oidc fails because of that?

@PPan1215
Copy link

PPan1215 commented Jun 22, 2023

Its been failing intermittently pretty much every day and it does seem to happen more frequently
when there are more concurrent Github jobs.

Do you plan to re-priortise and assign someone to do more proper investigation ?

the workflow file is super simple:

... // other stuff.
    - uses: aws-actions/configure-aws-credentials@v2
      with:
        aws-region: ${{ inputs.aws-region }}
        role-to-assume: ${{ inputs.aws-oidc-role-arn }}
...

Screenshot 2023-06-21 at 5 12 58 pm

@lmeynberg
Copy link

lmeynberg commented Jun 22, 2023

Its been failing intermittently pretty much every day and it does seem to happen more frequently
when there are more concurrent Github jobs.

I can second that. For a few days it became more frequent now.

@lkeijmel can you share the issue here maybe?

@peterwoodworth
Copy link
Contributor

peterwoodworth commented Jun 22, 2023

GitHub has been having some intermittent issues the past couple days, any increased errors could be due to that.

We are nearing a v3 release, some stuff has to get sorted out first internally so I can't give any dates. I doubt this error would stop in v3 though, since we aren't changing the way we're using getIDToken().

I've never been able to reproduce it, so I haven't been able to really investigate it. Hopefully the issue @lkeijmel opened in the actions/core repo may shed some light. Based on this thread and it's increased activity alongside some outages, I'd guess that it occurs as an intermittent GitHub issue, and getIDToken() isn't handling that case properly. Thanks to @lkeijmel for sharing the investigation that it occurs, at least some of the time, when getIDToken() is called.

@peterwoodworth
Copy link
Contributor

@lmeynberg here's the issue actions/toolkit#1441

@peterwoodworth peterwoodworth added effort/medium This issue will take a few days of effort to fix and removed effort/small This issue will take less than a day of effort to fix labels Jun 22, 2023
@lkeijmel
Copy link

For now I've forked this repo, added some additional logging in and around the getIDToken() function and use it in our workflows and hopefully we can pinpoint the issue further. Yesterday the workflows didn't have any issues so it's waiting for the next incident

@lkeijmel
Copy link

We've deploying without any issues so far this week, only a expired security token error sometimes but than was due to a longer run and a short TTL on the token itself. I just saw that github has written a blogpost regarding some OIDC issues which can be related to this: https://github.blog/changelog/2023-06-27-github-actions-update-on-oidc-integration-with-aws/

@alexef
Copy link

alexef commented Jul 13, 2023

This went away with the thumbprint change, but started happening again today. @lkeijmel can you also see the issue on your side?

@lkeijmel
Copy link

We don't see it currently on our deployments. After the blog post of the GH team we double checked the fingerprints but still no failures.

@peterwoodworth
Copy link
Contributor

I don't think this issue is related to the fingerprints issue, this error would occur before it gets a chance to send the request to the IDP if it's coming from the getIDToken call.

We've implemented the retry and backoff on the getIDToken call in the next major version, we're working towards a release for that.

@lkeijmel
Copy link

I just saw a blogpost from Github stating that pinning is no longer required and shouldn't be the issue.

@peterwoodworth
Copy link
Contributor

We now implement a retry behavior when the getIDToken call fails in v3, so please let me know if upgrading to v3 helps with this at all.

@peterwoodworth peterwoodworth added the response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days. label Aug 24, 2023
@peterwoodworth
Copy link
Contributor

I've subscribed to the issue @lkeijmel created, so I'll be up to date if there's any update there. Otherwise, I think the retry behavior on the token in v3 should patch this up

@github-actions
Copy link

** Note **
Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working effort/medium This issue will take a few days of effort to fix p2 response-requested Waiting on additional info and feedback. Will move to 'closing-soon' in 5 days.
Projects
None yet
Development

No branches or pull requests