-
Notifications
You must be signed in to change notification settings - Fork 647
Description
Checkboxes for prior research
- I've gone through Developer Guide and API reference
- I've checked AWS Forums and StackOverflow.
- I've searched for previous similar issues and didn't find any solution.
Describe the bug
- When using the latest AWS SDK for JavaScript v3 (Smithy-based), creating an S3Client for non-AWS S3-compatible endpoints (e.g., Google Cloud Storage) fails with:
CredentialsProviderError: Not found in ENV: AWS_DEFAULTS_MODE_ENV - This happens even when defaultsMode: 'legacy' is explicitly set in the client configuration.
- The error originates from the internal @smithy/node-config-provider → @smithy/util-defaults-mode-node provider chain, which still tries to read from process.env.AWS_DEFAULTS_MODE_ENV.
- This behavior breaks all S3-compatible integrations that don’t use AWS credentials or environment setup.
Environment Details
- SDK Package: @aws-sdk/client-s3
- SDK Version: 3.608.0 (also reproducible on 3.610.x)
- Node.js Version: v18.20.3
- Use Case: GCS S3-compatible API
- Region: Not applicable (using custom endpoint)
Regression Issue
- Select this option if this issue appears to be a regression.
SDK version number
@aws-sdk/package-name@version, ...
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
Node.js Version: v18.20.3
Reproduction Steps
import { S3Client } from "@aws-sdk/client-s3";
const s3 = new S3Client({
endpoint: "https://storage.googleapis.com/",
region: "us-east-1",
credentials: {
accessKeyId: "GOOGXXXXXX",
secretAccessKey: "YYYYYYYYYY"
},
defaultsMode: "legacy", // explicitly set
});Expected Behavior:
Client should initialize successfully and use legacy defaults mode without requiring any AWS environment variables.
Actual Behavior:
Throws immediately on client creation:
CredentialsProviderError: Not found in ENV: AWS_DEFAULTS_MODE_ENV at @smithy/node-config-provider/dist-cjs/index.js:28:15
Workarounds Tested
✅ Adding environment variable works:
export AWS_DEFAULTS_MODE=legacy
✅ Adding before import also works:
process.env.AWS_DEFAULTS_MODE = 'legacy';
const s3 = new S3Client(...);
❌ Setting defaultsMode: 'legacy' in constructor → still fails
❌ Passing via credentials object → still fails
Observed Behavior
Throws immediately on client creation:
CredentialsProviderError: Not found in ENV: AWS_DEFAULTS_MODE_ENV at @smithy/node-config-provider/dist-cjs/index.js:28:15
Expected Behavior
Expected Behavior:
Client should initialize successfully and use legacy defaults mode without requiring any AWS environment variables.
Possible Solution
No response
Additional Information/Context
No response