Skip to content

v3.830.0 ISSUE: fromEnv() suddenly now does not leverage credentials from AWS Lambda execution role #7132

@tfrancois

Description

@tfrancois

Checkboxes for prior research

Describe the bug

All of a sudden, all of my Lambda functions that used fromEnv() to reference the environment variables that are automatically provided by the execution role it is running under stopped working and hangs function execution until it times out.

According to the AWS documentation the following should always be true:

AWS Lambda functions automatically assume an IAM role, also known as the execution role, which grants them permissions to access other AWS services. This role's temporary credentials, including access key ID, secret access key, and session token, are made available to the Lambda function's environment as environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN. These variables are automatically injected by Lambda and should not be manually configured by the user.

After upgrading on my local dev environment to v3.830.0 of the AWS SDK and running my functions in the AWS production runtime environments this suddenly stopped working. They hang when it encounters fromEnv() usage:

{ ... credentials: fromEnv() }

This used to work flawlessly up until a couple of days ago. The workaround was to remove the fromEnv() entirely and the functions work as normally as before. Not sure if this is intended or the proper resolution to this new issue. Please advise and thank you.

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

NodeJS v18.20.3

Reproduction Steps

To reproduce this issue, simply use fromEnv() when instantiating a new DynamoDB client on NodeJS v18.20.3 or higher:

new DynamoDBClient({ 'region': region, 'credentials': fromEnv() }

Observed Behavior

Execution of the function hangs because the promise never gets resolved or rejected - it just hangs until it times out. Upon further investigation and searching through logs, the underlying error seems to be the following:

Unable to find environment variable credentials

Expected Behavior

The function should leverage the environment variables automatically provided by the execution role of the Lambda function its running under.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.p3This is a minor priority issueresponse-requestedWaiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions