aws / aws-lambda-dotnet

Libraries, samples and tools to help .NET Core developers develop AWS Lambda functions.
Apache License 2.0
1.58k stars 478 forks source link

AWS .NET Mock Lambda Test Tool should set AWS_LAMBDA_FUNCTION_VERSION environment variable #1593

Open dtPaTh opened 1 year ago

dtPaTh commented 1 year ago

Describe the feature

AWS .NET Mock Lambda Test Tool should set AWS_LAMBDA_FUNCTION_VERSION environment variable

Use Case

When instrumenting AWS Lambda functions with OpenTelemetry, this environment variable is used by the provided OpenTelemetry resource detector for AWS Lambda. If not set, the resource-detector throws an exception when configuring the TracerProviderBuilder. One needs to workaround, setting the environment variable e.g. within the launch options for the test tool.

image

Proposed Solution

AWS Lambda Test Tool should set AWS_LAMBDA_FUNCTION_VERSION environment variable

Other Information

No response

Acknowledgements

AWS .NET SDK and/or Package version used

Version shipped with AWS Toolkit for Visual Studio 2022 v 1.43.00

Targeted .NET Platform

.NET 6

Operating System and version

Windows 11

ashishdhingra commented 1 year ago

More details on AWS_LAMBDA_FUNCTION_VERSION could be found at Using Lambda environment variables. May be lambda test tool should set it to a acceptable dummy value by default, which could be overridden by new command line parameter.

Needs review with the team.

dtPaTh commented 11 months ago

I just figured out, testing SNS triggers, the otel resource detector is missing the AWS_REGION env var.