-
Couldn't load subscription status.
- Fork 11
added stream support #5
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
added stream support #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love how simple the new input is. Just a boolean. changing this input would also update the table, not only create. Is that correct? I think so from the code, but wanted to double check.
Just wanna make sure the table state is idempotent. Another edge case is, if the user changed the stream config using the console, after deployment, whatever in the yaml file should still be applied.
@dodgeblaster @eahefnawy Can I chip in and ask for making StreamViewType: 'NEW_AND_OLD_IMAGES' the default? This covers all bases and is also a requirement for the a global dynamo component I'm working on 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dodgeblaster ... looks good. Could you just update the README with this new input?
tobilg
commented
Dec 2, 2019
Any chance that there's an ETA for this?
Any chance that there's an ETA for this?
I'll take a look at this tonight
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added validation around stream types for creating and updating tables.
streamViewType just confirms they are using a correct view type, and will throw an error if they are not
streamViewTypeUpdate is a bit more subtle. If you change the viewType on an table that already has a stream, it wont do anything. Its possible people might assume it all worked unless they see a message explaining nothing actually happened. So I made an error for it.
@eahefnawy is throwing errors the best way to give messages like this in the CLI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is used in the update table function below.
I found that if I created a table with a stream, I would get returnValueFromCreateTable.TableDescription.LatestStreamArn successfully. But if I created a table with no stream, then set the stream to true in an update, the return value of the updateTable sdk call woud have returnValueFromUpdatTable.TableDescription.LatestStreamArn set to undefined (I am assuming that is because it takes a bit of time to register?). Running sls a second time will correctly give you the stream arn.
Anyways, that is a problem, because users will likely depend on getting a stream arn back from the outputs of this component. So the above function will try to get the stream arn, if it doesnt, it will wait 3 seconds and try again. It will do this 5 more times until it gets a stream arn. If it does not get it in 5 tries, it will throw an error.
The error does not mean the stream was not created, it just means we did not get the stream arn, which might be really important if the user is depending on the stream arn in other components.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ive added this disableStream flag here because the SDK will error if you try to disable a non existing stream. So this flag insures we only add this to the object if the inputs are disabling a stream that exists.
corentind59
commented
Jan 28, 2021
Hello, will this PR be merged ? Or is it too far from current git history ? @dodgeblaster @eahefnawy ?
No description provided.