LambdaBootstrap no longer throws if initialization fails when not using SnapStart #1881
Closed
1 task done
Labels
bug
This issue is a bug.
module/lambda-client-lib
needs-review
p2
This is a standard priority issue
potential-regression
Marking this issue as a potential regression to be checked by team member
Describe the bug
In my MartinCostello.Testing.AwsLambdaTestServer library I have a test that verifies that an exception is thrown if a function fails to startup.
With the changes to enable SnapStart in #1876 this appears to no longer occur an instead
RunAsync()
just runs to completion with no obvious sign of failure.Is this an intentional behaviour change? It seems like an oversight to me as with SnapStart enabled the code will terminate the process:
aws-lambda-dotnet/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs
Lines 216 to 221 in 7ca5c8c
But without, it will return false and then just return:
aws-lambda-dotnet/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs
Line 223 in 7ca5c8c
aws-lambda-dotnet/Libraries/src/Amazon.Lambda.RuntimeSupport/Bootstrap/LambdaBootstrap.cs
Lines 156 to 159 in 7ca5c8c
As an aside,
Environment.Exit(1)
isn't great from a testability perspective (IMHO) as ifIsInitTypeSnapstart
wastrue
in my test, it would terminate the test process.Regression Issue
Expected Behavior
An exception is thrown.
Current Behavior
LambdaBootstrap.RunAsync()
returns with no error without invoking the lambda function.Reproduction Steps
build.ps1
from the root of the cloned repository.Possible Solution
Preserve the original behaviour by throwing in the
catch
block ifIsInitTypeSnapstart
isfalse
.Additional Information/Context
No response
AWS .NET SDK and/or Package version used
Amazon.Lambda.RuntimeSupport 1.12.0
Targeted .NET Platform
.NET 9
Operating System and version
Any
The text was updated successfully, but these errors were encountered: