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

fix: CustomPojoSerializer only for Serde #1916

Merged
merged 3 commits into from
Oct 16, 2023
Merged

fix: CustomPojoSerializer only for Serde #1916

merged 3 commits into from
Oct 16, 2023

Conversation

sdelamo
Copy link
Contributor

@sdelamo sdelamo commented Oct 16, 2023

Close #1914

This PR remove the CustomPojoSerializer when using JacksonDatabind.

Jackson’s ObjectMapper creation requires customization which I don’t think it make sense to replicate in our CustomPojoSerializer.

https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-serialization/src/main/java/com/amazonaws/services/lambda/runtime/serialization/factories/JacksonFactory.java#L57-L93

Close #1914

This PR remove  the `CustomPojoSerializer` when using  `JacksonDatabind`.

Jackson’s  `ObjectMapper ` creation requires customization which I don’t think it make sense to replicate in our  `CustomPojoSerializer`.

https://github.com/aws/aws-lambda-java-libs/blob/main/aws-lambda-java-serialization/src/main/java/com/amazonaws/services/lambda/runtime/serialization/factories/JacksonFactory.java#L57-L93
Copy link
Contributor

@timyates timyates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 question and a suggestion for the docs wording...

I pushed a commit that cleaned up unused imports, added a private constructor to CustomPojoSerializerUtils and used generics in CustomPojoSerializerUtils.serializeFromJson -- which I think is correct

The reproducer for this issue passes locally, so I assume this only fails on AWS? Have you tried the reproducer on AWS with both Serde and Jackson?

@sonarcloud
Copy link

sonarcloud bot commented Oct 16, 2023

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

idea Catch issues before they fail your Quality Gate with our IDE extension sonarlint SonarLint

@sdelamo
Copy link
Contributor Author

sdelamo commented Oct 16, 2023

The reproducer for this issue passes locally, so I assume this only fails on AWS? Have you tried the reproducer on AWS with both Serde and Jackson?

It did not passed locally. It failed.

I moved src/main/resources/META-INF/services/com.amazonaws.services.lambda.runtime.CustomPojoSerializer to
aws-lambda-events-serde/src/main/resources/META-INF/services/com.amazonaws.services.lambda.runtime.CustomPojoSerializer so that for Jackson-databind it is not loaded.

I instead load in our tests the ObjectMapper with LambdaEventSerializers.serializerForwhich is the way internally AWS does it if you don't use have a CustomPojoSerializer.

@sdelamo sdelamo merged commit b9317d0 into master Oct 16, 2023
9 of 10 checks passed
@sdelamo sdelamo deleted the issue-1914 branch October 16, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MicronautRequestHandler no longer working with SQS and Jackson
2 participants