Skip to content

SnapStart: Using AddAWSLambdaBeforeSnapshotRequest() and AddHttpContextAccessor() in-conjunction causes initialization failure #2069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task
budgetdevv opened this issue May 9, 2025 · 3 comments
Labels
bug This issue is a bug. module/lambda-client-lib p2 This is a standard priority issue pr/needs-review This PR needs a review from a Member.

Comments

@budgetdevv
Copy link

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

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

@budgetdevv budgetdevv added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels May 9, 2025
@ppittle
Copy link
Member

ppittle commented May 12, 2025

Investigating

@ppittle
Copy link
Member

ppittle commented May 13, 2025

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.

@ashishdhingra ashishdhingra added pr/needs-review This PR needs a review from a Member. module/lambda-client-lib p2 This is a standard priority issue and removed needs-triage This issue or PR still needs to be triaged. labels May 14, 2025
@budgetdevv
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/lambda-client-lib p2 This is a standard priority issue pr/needs-review This PR needs a review from a Member.
Projects
None yet
Development

No branches or pull requests

3 participants