diff --git a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs index 1991729e9..15687be32 100644 --- a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs +++ b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction.SmokeTests/ImageFunctionTests.cs @@ -71,6 +71,7 @@ public ImageFunctionTests() [InlineData("ImageFunction::ImageFunction.Function::Ping", "ping", "pong")] [InlineData("ImageFunction::ImageFunction.Function::HttpsWorksAsync", "", "SUCCESS")] [InlineData("ImageFunction::ImageFunction.Function::VerifyLambdaContext", "", "SUCCESS")] + [InlineData("ImageFunction::ImageFunction.Function::VerifyTzData", "", "SUCCESS")] public async Task SuccessfulTests(string handler, string input, string expectedResponse) { await UpdateHandlerAsync(handler); @@ -170,6 +171,7 @@ await _lambdaClient.CreateFunctionAsync(new CreateFunctionRequest MemorySize = 512, Role = _executionRoleArn, PackageType = PackageType.Image, + Timeout = 30, Architectures = new List {GetArchitecture()} }); break; diff --git a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs index ab280d0a8..128876e7d 100644 --- a/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs +++ b/LambdaRuntimeDockerfiles/SmokeTests/test/ImageFunction/Function.cs @@ -116,6 +116,18 @@ public string VerifyLambdaContext(ILambdaContext lambdaContext) return GetResponse(true); } + // .NET on Linux uses the tzdata system package to get time zone information. + // If TzData is not installed/available in the Linux environment the + // TimeZoneInfo.GetSystemTimeZones() will return an empty collection. + // For futher information: https://github.com/aws/aws-lambda-dotnet/issues/1620 + public string VerifyTzData(ILambdaContext lambdaContext) + { + AssertTrue(TimeZoneInfo.GetSystemTimeZones().Count > 0, "No time zones were found"); + AssertNotNull(TimeZoneInfo.FindSystemTimeZoneById("Europe/London"), "Failed to find Europe/London timezone"); + + return SuccessResult; + } + #endregion #region Private methods diff --git a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs index a9df6f53b..07bf8ecb2 100644 --- a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs +++ b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Diagnostics/DiagnosticDescriptors.cs @@ -74,9 +74,9 @@ public static class DiagnosticDescriptors DiagnosticSeverity.Error, isEnabledByDefault: true); - public static readonly DiagnosticDescriptor UnsupportedMethodParamaterType = new DiagnosticDescriptor(id: "AWSLambda0109", - title: "Unsupported Method Paramater Type", - messageFormat: "Unsupported query paramter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerables can be used as query parameters.", + public static readonly DiagnosticDescriptor UnsupportedMethodParameterType = new DiagnosticDescriptor(id: "AWSLambda0109", + title: "Unsupported Method Parameter Type", + messageFormat: "Unsupported query parameter '{0}' of type '{1}' encountered. Only primitive .NET types and their corresponding enumerable can be used as query parameters.", category: "AWSLambdaCSharpGenerator", DiagnosticSeverity.Error, isEnabledByDefault: true); diff --git a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs index e502f1530..74dd4dee0 100644 --- a/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs +++ b/Libraries/src/Amazon.Lambda.Annotations.SourceGenerator/Generator.cs @@ -200,7 +200,7 @@ public void Execute(GeneratorExecutionContext context) continue; } - if (!AreLambdaMethodParamatersValid(lambdaMethod, model, diagnosticReporter)) + if (!AreLambdaMethodParametersValid(lambdaMethod, model, diagnosticReporter)) { foundFatalError = true; continue; @@ -384,7 +384,7 @@ public void Initialize(GeneratorInitializationContext context) context.RegisterForSyntaxNotifications(() => new SyntaxReceiver(_fileManager, _directoryManager)); } - private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter) + private bool AreLambdaMethodParametersValid(MethodDeclarationSyntax declarationSyntax, LambdaFunctionModel model, DiagnosticReporter diagnosticReporter) { var isValid = true; foreach (var parameter in model.LambdaMethod.Parameters) @@ -398,7 +398,7 @@ private bool AreLambdaMethodParamatersValid(MethodDeclarationSyntax declarationS if (!parameter.Type.IsPrimitiveType() && !parameter.Type.IsPrimitiveEnumerableType()) { isValid = false; - diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParamaterType, + diagnosticReporter.Report(Diagnostic.Create(DiagnosticDescriptors.UnsupportedMethodParameterType, Location.Create(declarationSyntax.SyntaxTree, declarationSyntax.Span), parameterKey, parameter.Type.FullName)); } diff --git a/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs b/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs index f2c713ece..a8224a32c 100644 --- a/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs +++ b/Libraries/src/Amazon.Lambda.Annotations/APIGateway/HttpResults.cs @@ -3,7 +3,6 @@ using System.IO; using System.Linq; using System.Net; -using Amazon.Lambda.Core; #if NET6_0_OR_GREATER using System.Buffers; using System.Text.Json; @@ -21,7 +20,7 @@ namespace Amazon.Lambda.Annotations.APIGateway { /// - /// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda funtion. + /// The options used by the IHttpResult to serialize into the required format for the event source of the Lambda function. /// public class HttpResultSerializationOptions { @@ -55,7 +54,7 @@ public enum ProtocolVersion { /// /// The API Gateway protocol used as the event source. - /// RestApi -> RestApiAttrbute + /// RestApi -> RestApiAttribute /// HttpApi -> HttpApiAttribute /// public ProtocolFormat Format { get; set; } @@ -272,11 +271,11 @@ public static IHttpResult Ok(object body = null) /// Creates an IHttpResult for redirect responses. /// /// - /// This method uses the same logic for determing the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses. + /// This method uses the same logic for determining the the Http status code as the Microsoft.AspNetCore.Http.TypedResults.Redirect uses. /// https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.typedresults.redirect /// /// The URI to redirect to. The value will be set in the location header. - /// Whether the redirect should be a permanet (301) or temporary (302) redirect. + /// Whether the redirect should be a permanent (301) or temporary (302) redirect. /// Whether the request method should be preserved. If set to true use 308 for permanent or 307 for temporary redirects. /// public static IHttpResult Redirect(string uri, bool permanent = false, bool preserveMethod = false) @@ -317,7 +316,8 @@ public static IHttpResult Redirect(string uri, bool permanent = false, bool pres public static IHttpResult ServiceUnavailable(int? delaySeconds = null) { var result = new HttpResults(HttpStatusCode.ServiceUnavailable); - if (delaySeconds != null && delaySeconds > 0) + + if (delaySeconds > 0) { result.AddHeader("Retry-After", delaySeconds.ToString()); } @@ -488,7 +488,7 @@ private static IDictionary ConvertToV2MultiValueHeaders(IDiction // See comment at the top about .NET Standard 2.0 #if !NETSTANDARD2_0 - // Class representing the V1 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can + // Class representing the V1 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayProxyResponse but this library can // not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version. internal class APIGatewayV1Response { @@ -505,7 +505,7 @@ internal class APIGatewayV1Response public bool IsBase64Encoded { get; set; } } - // Class representing the V2 API Gateway response. Very similiar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can + // Class representing the V2 API Gateway response. Similar to Amazon.Lambda.APIGatewayEvents.APIGatewayHttpApiV2ProxyResponse but this library can // not take a dependency on Amazon.Lambda.APIGatewayEvents so it has to have its own version. internal class APIGatewayV2Response { diff --git a/buildtools/build.proj b/buildtools/build.proj index e7552c3e0..a8edf292d 100644 --- a/buildtools/build.proj +++ b/buildtools/build.proj @@ -9,7 +9,7 @@ dotnet pack --no-build -c $(Configuration) -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages dotnet pack --no-build -o $(MSBuildThisFileDirectory)/../Deployment/nuget-packages true - $(MSBuildThisFileDirectory)local-development.snk + $(MSBuildThisFileDirectory)/public.snk --updateVersions false diff --git a/buildtools/common.props b/buildtools/common.props index de3a3260e..f0c4b9113 100644 --- a/buildtools/common.props +++ b/buildtools/common.props @@ -1,8 +1,8 @@ - $(MSBuildThisFileDirectory)local-development.snk - false + $(MSBuildThisFileDirectory)/public.snk + true Amazon Web Services diff --git a/buildtools/local-development.snk b/buildtools/local-development.snk deleted file mode 100644 index be0ad9c59..000000000 Binary files a/buildtools/local-development.snk and /dev/null differ diff --git a/buildtools/public.snk b/buildtools/public.snk new file mode 100644 index 000000000..709adb3d6 Binary files /dev/null and b/buildtools/public.snk differ