Skip to content
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

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

Open
curtisms opened this issue Nov 27, 2024 · 1 comment
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 deki self-assigned this Nov 28, 2024
@deki deki added the bug label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants