Description
Checkboxes for prior research
- I've gone through Developer Guide and API referenceI'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
Activity
[-]v3.830.0 Issue: fromEnv suddenly now does not leverage credentials from AWS Lambda role credentials[/-][+]v3.830.0 ISSUE: fromEnv() suddenly now does not leverage credentials from AWS Lambda role credentials[/+][-]v3.830.0 ISSUE: fromEnv() suddenly now does not leverage credentials from AWS Lambda role credentials[/-][+]v3.830.0 ISSUE: fromEnv() suddenly now does not leverage credentials from AWS Lambda execution role[/+]aBurmeseDev commentedon Jun 20, 2025
Hi @tfrancois - thanks for reaching out.
Can you share your code snippet, error logs and env variables?
I'm not seeing any major change in recent versions, have you changed any env variables?
tfrancois commentedon Jun 21, 2025
Hi @aBurmeseDev - thank you for your prompt reply to this issue. I'm embarrassed - the issue was definitely on my end. Everything seems to be working as expected - I'm not sure what I was doing incorrectly but issue went away unexpectedly. Thanks again!
github-actions commentedon Jun 21, 2025
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
github-actions commentedon Jul 6, 2025
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.