aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.59k stars 1.55k forks source link

S3Client initialization failes for credentials fromEnv() #4547

Closed skew202 closed 9 months ago

skew202 commented 9 months ago

Describe the bug

When creating an S3Client with the aws-sdk the initialisation failes for UA_APP_ID_ENV_NAME in @smithy/node-config-provider

Expected Behavior

A successfully initialized S3Client using the variables available in the process.env

Current Behavior

Exception has occurred: CredentialsProviderError: Cannot load config from environment variables with getter: (env) => env[exports.UA_APP_ID_ENV_NAME]
  at /node_modules/@smithy/node-config-provider/dist-cjs/fromEnv.js:14:15
    at /node_modules/@smithy/property-provider/dist-cjs/chain.js:12:39
    at coalesceProvider (/node_modules/@smithy/property-provider/dist-cjs/memoize.js:11:23)
    at /node_modules/@smithy/property-provider/dist-cjs/memoize.js:26:34
    at defaultUserAgent (/node_modules/@aws-sdk/util-user-agent-node/dist-cjs/index.js:34:7)
    at getRuntimeConfig (/node_modules/@aws-sdk/client-s3/dist-cjs/runtimeConfig.js:39:57)
    at new S3Client (/node_modules/@aws-sdk/client-s3/dist-cjs/S3Client.js:24:64)

Reproduction Steps

.env

AWS_ACCESS_KEY_ID=ABC1234567890
AWS_SECRET_ACCESS_KEY=Abcd1234567890
AWS_REGION=eu-central-1

.index.js

import { S3Client } from "@aws-sdk/client-s3";
import { fromEnv } from "@aws-sdk/credential-providers";

const s3Client = new S3Client({
    credentials: fromEnv()
});

Possible Solution

No response

Additional Information/Context

No response

SDK version used

3.470.0

Environment details (OS name and version, etc.)

Node v18.17.0

skew202 commented 9 months ago

Wrong version. Opened https://github.com/aws/aws-sdk-js-v3/issues/5574 instead