Skip to content

When invoking a function with CONTENT-TYPE in multiValueHeaders the function fails with a NPE #1193

New issue

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

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

Already on GitHub? # to your account

Closed
curtisms opened this issue Nov 27, 2024 · 2 comments
Assignees
Labels

Comments

@curtisms
Copy link

Serverless Java Container version: 2.1.0

Implementations: Spring Boot 3

Framework version: SpringBoot 3.4.0

Frontend service: Step Functions (test invoke using Lambda Power Tuning)

Deployment method: CDK

Scenario

Running through Java on Lambda workshop (https://github.com/aws-samples/aws-lambda-java-workshop) Power Tuning section

Expected behavior

Lambda function (and Step Function execution) should complete successfully

Actual behavior

The Lambda invokes fail with a NPE. This looks to be due to the content-type header being in multiValueHeaders instead of in headers in the payload.

Steps to reproduce

Follow steps in workshop for Power Tuning

Full log output

java.lang.NullPointerException: Cannot invoke "com.amazonaws.serverless.proxy.model.SingleValueHeaders.get(Object)" because the return value of "com.amazonaws.serverless.proxy.model.AwsProxyRequest.getHeaders()" is null: java.lang.IllegalStateException
java.lang.IllegalStateException: java.lang.NullPointerException: Cannot invoke "com.amazonaws.serverless.proxy.model.SingleValueHeaders.get(Object)" because the return value of "com.amazonaws.serverless.proxy.model.AwsProxyRequest.getHeaders()" is null
	at com.amazonaws.serverless.proxy.spring.AwsSpringHttpProcessingUtils.generateHttpServletRequest(AwsSpringHttpProcessingUtils.java:97)
	at com.amazonaws.serverless.proxy.spring.SpringDelegatingLambdaContainerHandler.handleRequest(SpringDelegatingLambdaContainerHandler.java:68)
Caused by: java.lang.NullPointerException: Cannot invoke "com.amazonaws.serverless.proxy.model.SingleValueHeaders.get(Object)" because the return value of "com.amazonaws.serverless.proxy.model.AwsProxyRequest.getHeaders()" is null
	at com.amazonaws.serverless.proxy.spring.AwsSpringHttpProcessingUtils.generateRequest1(AwsSpringHttpProcessingUtils.java:129)
	at com.amazonaws.serverless.proxy.spring.AwsSpringHttpProcessingUtils.generateHttpServletRequest(AwsSpringHttpProcessingUtils.java:110)
	at com.amazonaws.serverless.proxy.spring.AwsSpringHttpProcessingUtils.generateHttpServletRequest(AwsSpringHttpProcessingUtils.java:95)
	... 1 more
@deki
Copy link
Collaborator

deki commented Nov 28, 2024

Thanks for the bug report, I can acknowledge this is a regression introduced by #1085. @npeters fyi

@deki
Copy link
Collaborator

deki commented Jan 8, 2025

fixed as part of 2.1.1

@deki deki closed this as completed Jan 8, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants