Skip to content

Maintenance: AWS_REGION environment variable required after upgrading to @aws-lambda-powertools/logger v2.25.0 #4318

@MaxOpperman

Description

@MaxOpperman

Summary

After upgrading @aws-lambda-powertools/logger from version 2.24.1 to 2.25.0, my local tests fail with the following error:

Environment variable AWS_REGION is required

Previously, I could run tests locally without setting AWS_REGION, since all AWS calls are mocked and my tests only verify log output. Requiring AWS_REGION for local/unit tests feels unnecessary and makes testing more cumbersome.

Is this an intentional change? If so, could there be a way to relax this requirement for local/test environments?

Thanks for your help!

Why is this needed?

This will make local & unit testing easier and fixes an issue that was created between version 2.24.1 and 2.25.0. It enhances backwards compatibility.

Which area does this relate to?

No response

Solution

I believe the fix could be to add a defaultValue: '' for AWS_REGION when reading the environment variable, similar to how other environment variables are handled.

Acknowledgment

Future readers

Please react with 👍 and your use case to help us understand customer demand.

Metadata

Metadata

Assignees

Labels

confirmedThe scope is clear, ready for implementationinternalPRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)loggerThis item relates to the Logger Utility

Type

No type

Projects

Status

Coming soon

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions