Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

MarshallRequest - NullReference exception #1819

Unanswered
KarimBenhallam asked this question in Q&A
Discussion options

I am currently trying to publish a .NET8 backend on AWS Lambda. When testing my lambda function, I get this exact error:

image

Checking cloudwatch did not help much, as I got the exact same error.

image

Is anybody familiar with this error? Thank you in advance.

I tried different root paths, different request paths to try and find the source of the error, but I cannot find it.

You must be logged in to vote

Replies: 1 comment 3 replies

Comment options

Hi @KarimBenhallam,

Thank you for providing the details and the stack trace. The error Object reference not set to an instance of an object indicates that one of the objects being passed to the MarshallRequest method in the Amazon.Lambda.AspNetCoreServer.APIGatewayProxyFunction class is null, which is causing the NullReferenceException.

Could you please review the MarshallRequest method and identify which of the following objects is potentially null? Once you've identified the null object, you can ensure that it's properly initialized in your Lambda function code.

If you're still unable to resolve the issue after investigating the objects passed to MarshallRequest, please feel free to convert this Discussion to an Issue (or new Issue). And provide necessary details, such a self-contained, concise snippet of code and reproduction steps, which might help us better reproduce and troubleshoot the problem.

Regards,
Chaitanya

You must be logged in to vote
3 replies
Comment options

Hi @bhoradc

This error only intervenes when I test the lambda function on AWS directly. When I build and test my backend endpoints locally, my code runs smoothly. If there is a way to investigate the objects passed to the MarshallRequest method on the AWS interface, I'll be happy to do so.

I tried purposefully calling a non-existing endpoint url to compare behaviours, and I still get the exact same message as earlier, which means the error occurs before the request even reaches my controller.

I'll be happy to follow your debugging instructions, as I am stuck at this point.

Thank you in advance!

Comment options

normj Oct 1, 2024
Maintainer

Can you set the environment variable LAMBDA_NET_SERIALIZER_DEBUG to true on the deployed Lambda function? That will output the incoming Lambda JSON event to CloudWatch logs and that could give us a clue what is null. If possible and nothing sensitive in the JSON it would be great if you could post the JSON here.

Comment options

Can you set the environment variable LAMBDA_NET_SERIALIZER_DEBUG to true on the deployed Lambda function? That will output the incoming Lambda JSON event to CloudWatch logs and that could give us a clue what is null. If possible and nothing sensitive in the JSON it would be great if you could post the JSON here.

It is already set to true, but I see nothing in the cloudwatch logs as shown in my post.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

AltStyle によって変換されたページ (->オリジナル) /