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.

@aws-sdk/credential-provider-node incorrect documentation

See original GitHub issue

Describe the issue with documentation

A clear and concise description of what the issue is.

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_credential_provider_node.html

const { getDefaultRoleAssumerWithWebIdentity } = require("@aws-sdk/client-sts");
const { defaultProvider } = require("@aws-sdk/credential-provider-node");
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");

const provider = defaultProvider({
  roleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity,
});

const client = new S3Client({ credentialDefaultProvider: provider });

Assigning provider to credentialDefaultProvider like the documentation suggests results in errors.

image

Steps to reproduce

Please share code or minimal repo if required, and steps to reproduce the behavior.

import { DynamoDBClient, DynamoDBClientConfig } from '@aws-sdk/client-dynamodb';
import { defaultProvider } from '@aws-sdk/credential-provider-node';
  const dynamoDBClientConfig: DynamoDBClientConfig = {
    region: config.AWS_REGION,
    credentialDefaultProvider: defaultProvider({
      roleArn: config.ROLE_ARN,
      durationSeconds: config.DURATION,
    }),
  };

Observed behavior

A clear and concise description of what happens.

Expected behavior

A clear and concise description of what you were expecting to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
TroutZencommented, Nov 5, 2021

➕ - Also seeing the same error. @samchungy - Thanks for the workaround soln.

0reactions
samchungycommented, Feb 10, 2022

Yeah good finds, I didn’t look into to it too much tbh @adworacz. Just wanted to highlight that the doco was wrong. I did also state:

Depends on what you’re trying to do?

In my case I was simply looking for how to use STS roles and fromTemporaryCredentials is the easiest way as it allows for chaining of roles too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module @aws-sdk/credential-provider-node
AWS Credential Provider for Node.JS. This module provides a factory function, fromEnv , that will attempt to source AWS credentials from a Node....
Read more >
@aws-sdk/credential-providers | AWS SDK for JavaScript v3
This credential provider is intended for use with the AWS SDK for Node.js. Supported configuration. You may customize how credentials are resolved by...
Read more >
Setting Credentials in Node.js - AWS ... - AWS Documentation
Credentials loaded from the ECS credentials provider (if applicable). Credentials that are obtained by using a credential process specified in the shared AWS...
Read more >
Setting credentials in Node.js - AWS ... - AWS Documentation
Here's the order of the sources where the default credential provider resolve credentials from: Environment variables. The shared credentials file. Credentials ...
Read more >
@aws-sdk/credential-provider-ini | AWS SDK for JavaScript v3
@aws-sdk/credential-provider-ini. NPM version NPM downloads. An internal package. Usage. You probably shouldn't, at least directly. Please use ...
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