Git Product home page Git Product logo

Comments (4)

pankajagrawal16 avatar pankajagrawal16 commented on September 25, 2024

Hi @asmith-r7

I understand the problem you are facing. Perhaps rite now you might have to pass a valid event to make it work.

At this point, I am thinking perhaps we can let users override the default object mapper instance via an environment variable instead of having something to toggle the logging behavior.

So having something like an api defaultObjectMapper which can be used to override default one if needed by clients.

Thoughts?

from powertools-lambda-java.

asmith-r7 avatar asmith-r7 commented on September 25, 2024

Hi, thanks for the response. I was able to work around the problem by doing as you suggested. I remember the last time I had looked into creating an S3Event from a json file I had ran into problems but it looks like since then a testing library was released and it solves the problem 🎉 :
https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-tests

The only disadvantage to this approach was using a mock made it really easy to dynamically change the keys etc in the event being passed in but that library seems to rely on supplying a JSON file each time.

I still could see exposing the object mapper being a good idea though.

from powertools-lambda-java.

pankajagrawal16 avatar pankajagrawal16 commented on September 25, 2024

Hi, thanks for the response. I was able to work around the problem by doing as you suggested. I remember the last time I had looked into creating an S3Event from a json file I had ran into problems but it looks like since then a testing library was released and it solves the problem 🎉 :
https://github.com/aws/aws-lambda-java-libs/tree/master/aws-lambda-java-tests

The only disadvantage to this approach was using a mock made it really easy to dynamically change the keys etc in the event being passed in but that library seems to rely on supplying a JSON file each time.

I still could see exposing the object mapper being a good idea though.

Great to hear that you got it working now with valid event object. In a way its good to unit test things with a valid event object to avoid getting surprises in staging or production environment. But, I do understand mocks can be convenient for iterating faster.

I will leave this issue open for now and probably expose an api to let clients override object mapper as well which can probably compliment RFC #66 as well.

from powertools-lambda-java.

pankajagrawal16 avatar pankajagrawal16 commented on September 25, 2024

Available in 1.3.0 now

from powertools-lambda-java.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.