-
Notifications
You must be signed in to change notification settings - Fork 494
MarshallRequest - NullReference exception #1819
-
I am currently trying to publish a .NET8 backend on AWS Lambda. When testing my lambda function, I get this exact error:
Checking cloudwatch did not help much, as I got the exact same error.
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.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 3 replies
-
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
Beta Was this translation helpful? Give feedback.
All reactions
-
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!
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
Beta Was this translation helpful? Give feedback.
All reactions
-
Can you set the environment variable
LAMBDA_NET_SERIALIZER_DEBUGtotrueon 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.
Beta Was this translation helpful? Give feedback.