SnapStart: Using AddAWSLambdaBeforeSnapshotRequest() and AddHttpContextAccessor() in-conjunction causes initialization failure
Describe the bug
As described above. See: https://github.com/budgetdevv/AWSSnapStartBugRepro/blob/5833e924110e59d3cc574461ecf2023802a0d1dd/SnapStartBugTest/src/SnapStartBugTest/Program.cs#L14C10-L14C32
Regression Issue
- [ ] Select this option if this issue appears to be a regression.
Expected Behavior
It should be able to initialize.
Current Behavior
It fails to initialize with an exception.
Reproduction Steps
- Deploy the repo @ https://github.com/budgetdevv/AWSSnapStartBugRepro into an AWS Lambda instance
- Enable SnapStart
- Publish a version to trigger SnapStart's snapshotting
Possible Solution
Currently I am using a custom HttpContextAccessor to circumvent this
Additional Information/Context
Do look into the stacktrace here: https://gist.github.com/budgetdevv/b1304220f2cf3921723109a53f9a82a0#file-gistfile1-txt-L32
AWS .NET SDK and/or Package version used
Targeted .NET Platform
.NET 8
Operating System and version
OSX Sonoma
Investigating
Was able to reproduce this issue, but needed to change this line to use LambdaEventSource.RestApi.
With that, and #2071, the Lambda deploys and functions correctly.
Was able to reproduce this issue, but needed to change this line to use
LambdaEventSource.RestApi.With that, and #2071, the Lambda deploys and functions correctly.
I believe it is because I am using a function URL
Fix has been released and is available in Amazon.Lambda.AspNetCoreServer 9.1.1 and Amazon.Lambda.AspNetCoreServer.Hosting 1.8.1
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.