Coder Social home page Coder Social logo

Comments (5)

michalkvasnicak avatar michalkvasnicak commented on May 14, 2024 2

Ok so I found a little time to do something about this. It seems it doesn't matter if there is JSON.stringify because if you are storing events to DynamoDB from some other place and you aren't using PubSub at all, then you can store an object, see https://github.com/michalkvasnicak/aws-lambda-graphql/blob/master/packages/aws-lambda-graphql/src/ArrayPubSub.ts#L35. But I made a change to PubSub that it takes an optional option serializeEventPayload that can be set to false if you don't want to use JSON.serialize in PubSub

from aws-lambda-graphql.

ebarault avatar ebarault commented on May 14, 2024 1

@michalkvasnicak Well actually in particular in the contexte of DyanamoDB i don't see the reason why to force the payload to be a string, as DynamoDB would accept any arbitrary form of JSON object.

We have a situation where the writer of the events in the DynamoDB event table is totally out of scope of this library, as it cannot use a graphql mutation to write the events. So we have to fallback to the writing the raw data in DynamoDB, and it clutters a bit the code to have to JSON.stringify the payload.

Also it make the payload unreadable in the DyanamoDB explorer, which is bad and when debugging.

It would be great if you could relax this constrain.
What do you think?

from aws-lambda-graphql.

michalkvasnicak avatar michalkvasnicak commented on May 14, 2024 1

@ebarault yes I you're right. The problem is backward compatibility. Maybe we could remove JSON.serialize from PubSub and use it directly in DynamoDBEventStore and add an option to disable it completely so it won't break existing apps after upgrade.

from aws-lambda-graphql.

michalkvasnicak avatar michalkvasnicak commented on May 14, 2024

@ebarault sorry for the late response. That's actually a good question. I'm not quite sure at the moment why I used JSON.stringify. I think it's from the legacy 0.x version which used DynamoDB mainly and I wanted to make sure that userland code is trying to store only JSON serializable values to DynamoDB.

Does it cause problems for you?

from aws-lambda-graphql.

ebarault avatar ebarault commented on May 14, 2024

@michalkvasnicak yes, that sounds like a reasonable way forward to offer more flexibility while keeping backward compatibility

from aws-lambda-graphql.

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.