-
Notifications
You must be signed in to change notification settings - Fork 634
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
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