Comments (5)
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.
@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.
@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.
@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.
@michalkvasnicak yes, that sounds like a reasonable way forward to offer more flexibility while keeping backward compatibility
from aws-lambda-graphql.
Related Issues (20)
- 502 bad gateway using type-graphql HOT 1
- Usage w/ Apollo Federation HOT 1
- Client not receiving updates HOT 1
- Expose unsubscribe in PubSub HOT 1
- Scaling related questions HOT 1
- Do I must to use DynamoDB storage? HOT 1
- How do I listen on the socket of 'connect' 'disconnet' method ? HOT 1
- Send the events from other apis HOT 2
- Duplicated message every period of time
- Error "Address already in use" while running example chat server with serverless-offline
- Routes for webSocketHandler, dynamoDBStreamHandler and httpHandler not create
- AWS SDK v3 Compatibility HOT 2
- The packages demo can't running
- How to pass DataSources to Context? HOT 2
- How to use at aws?
- How can I access express object from context function?
- How to use subscriptions with `type-graphql`? HOT 1
- InvalidSignatureException Error after moving from Regional Gateway to CloudFront
- Any plans for support apollo server 3? HOT 3
- Deleting old subscribers fails with ValidationException
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-lambda-graphql.