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

@aws-sdk/credential-providers 3.730.0 credentials is missing error #6816

Open
4 tasks done
samchungy opened this issue Jan 17, 2025 · 8 comments
Open
4 tasks done

@aws-sdk/credential-providers 3.730.0 credentials is missing error #6816

samchungy opened this issue Jan 17, 2025 · 8 comments
Assignees
Labels
bug This issue is a bug. p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@samchungy
Copy link
Contributor

samchungy commented Jan 17, 2025

Checkboxes for prior research

Describe the bug

We ran into an error on Lambda when we bumped up our credential-providers package to 3.730.0.

err: {
     message: `credentials` is missing
     stack: Error: `credentials` is missing
    at credentialsProvider (/var/task/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js:211:15)
    at boundCredentialsProvider (/var/task/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js:215:71)
    at /var/task/node_modules/@smithy/core/dist-cjs/index.js:85:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /var/task/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
    at async /var/task/node_modules/@aws-sdk/credential-providers/dist-cjs/fromTemporaryCredentials.js:50:33
    at async coalesceProvider (/var/task/node_modules/@smithy/core/dist-cjs/index.js:368:18)
    at async /var/task/node_modules/@smithy/core/dist-cjs/index.js:386:18
    at async /var/task/node_modules/@smithy/core/dist-cjs/index.js:85:17
    at async /var/task/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
     type: Error
   }

I couldn't quite spot much in the diff: https://npmdiff.dev/%40aws-sdk%2Fcredential-providers/3.729.0/3.730.0/

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/[email protected]

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node 20.18.0, Node 22.

Reproduction Steps

https://github.com/samchungy/aws-credentials-provider-bug

Observed Behavior

fromTemporaryCredentials throws an error

Expected Behavior

It should not throw an error when using fromTemporaryCredentials

Possible Solution

No response

Additional Information/Context

No response

@samchungy samchungy added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 17, 2025
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Jan 17, 2025
72636c added a commit to seek-oss/rynovate that referenced this issue Jan 17, 2025
Hopefully this helps with the obvious cases, though the dependency could
still be pulled in transitively.

aws/aws-sdk-js-v3#6816
72636c added a commit to seek-oss/rynovate that referenced this issue Jan 17, 2025
Hopefully this helps with the obvious cases, though the dependency could
still be pulled in transitively.

aws/aws-sdk-js-v3#6816
@kuhe kuhe self-assigned this Jan 17, 2025
@kuhe kuhe added p1 This is a high priority issue and removed needs-triage This issue or PR still needs to be triaged. labels Jan 17, 2025
@kuhe
Copy link
Contributor

kuhe commented Jan 17, 2025

Thanks for submitting this report. I am investigating this issue.

As a workaround, please use 3.729.0, or provide credentials like this:

import { PublishCommand, SNSClient } from "@aws-sdk/client-sns";
import { fromTemporaryCredentials, fromNodeProviderChain } from "@aws-sdk/credential-providers";

const sns = new SNSClient({
  region: "ap-southeast-2",
  credentials: fromTemporaryCredentials({
    params: {
      RoleArn: "arn:aws:iam::000000000000:role/some-role",
      RoleSessionName: "some-session",
    },
    masterCredentials: fromNodeProviderChain()
  }),
});

@brchri
Copy link

brchri commented Jan 17, 2025

I ran into something similar today when upgrading the @aws-sdk/client-dynamodb package to v3.730.0, which adds the nested dependency for @aws-sdk/nested-clients. We use tree shaking when building our artifacts, and our tree shaking process threw this error:

ERROR Error: Encountered resolution error in ./node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js for ./submodules/sts/endpoint/EndpointParameters: Error: Cannot find module './submodules/sts/endpoint/EndpointParameters' from './node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc'

After digging into the mentioned file (@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc/index.js), I found some bad require statements:

var import_httpAuthSchemeProvider = require("./submodules/sts/auth/httpAuthSchemeProvider");
var import_EndpointParameters = require("./submodules/sts/endpoint/EndpointParameters");
var import_runtimeConfig = require("./submodules/sts/runtimeConfig");
var import_runtimeExtensions = require("./submodules/sts/runtimeExtensions");
var import_EndpointParameters2 = require("./submodules/sts/endpoint/EndpointParameters");
var import_EndpointParameters3 = require("./submodules/sts/endpoint/EndpointParameters");

Those paths don't exist, and should be ../../submodules/sts/<...>. I updated these lines to the correct path and then our tree shaking process was successful. This seems to be a regression bug, as we didn't have this issue prior to bumping our @aws-sdk/client-dynamodb package.

Hope this helps.

@kuhe
Copy link
Contributor

kuhe commented Jan 17, 2025

@brchri thanks for reporting this too. I have created a fix PR for this and the original issue to be released later today.

@kuhe
Copy link
Contributor

kuhe commented Jan 17, 2025

Fixes were released in https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.731.0.

@kuhe kuhe added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed pending-release This issue will be fixed by an approved PR that hasn't been released yet. labels Jan 17, 2025
@brchri
Copy link

brchri commented Jan 17, 2025

3.731.0 did not resolve the issue I mentioned unfortunately. To reproduce:

  1. Create new folder and cd into it
  2. yarn init - accept all defaults
  3. yarn add @aws-sdk/[email protected]
  4. cd node_modules/@aws-sdk/nested-clients/dist-cjs/submodules/sso-oidc and inspect the index.js file.

It still incorrectly shows paths such as:

var import_EndpointParameters2 = require("./submodules/sts/endpoint/EndpointParameters");
var import_EndpointParameters3 = require("./submodules/sts/endpoint/EndpointParameters");

My tree shaking is also still throwing the error, as I would expect with the above findings.

I also confirmed in the node_modules/@aws-sdk/nested-clients/package.json file that it is indeed version 3.731.0.

I can create a separate issue for this if that makes sense, I added it here because I saw OP's error was referencing the same paths and thought it might be related, but if it's not and you'd rather track this separately, I can create a separate issue, I didn't mean to hijack this one.

@kuhe
Copy link
Contributor

kuhe commented Jan 17, 2025

I see the issue is still there. There may be a problem with a stale build cache. I will investigate.

@kuhe kuhe added pending-release This issue will be fixed by an approved PR that hasn't been released yet. and removed response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. labels Jan 17, 2025
@kuhe
Copy link
Contributor

kuhe commented Jan 18, 2025

We confirmed it was a build cache error, and we are preparing a new release.

@kuhe
Copy link
Contributor

kuhe commented Jan 18, 2025

The new release was completed about 13 hours ago here: https://github.com/aws/aws-sdk-js-v3/releases/tag/v3.731.1.

@kuhe kuhe added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed pending-release This issue will be fixed by an approved PR that hasn't been released yet. labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p1 This is a high priority issue potential-regression Marking this issue as a potential regression to be checked by team member response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants