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

ex.DynamodbTable is missing DynamoDB Streams #4949

Closed
skyrpex opened this issue Nov 15, 2023 · 8 comments · Fixed by winglang/winglibs#98
Closed

ex.DynamodbTable is missing DynamoDB Streams #4949

skyrpex opened this issue Nov 15, 2023 · 8 comments · Fixed by winglang/winglibs#98
Assignees
Labels
🐛 bug Something isn't working 🐶 dogfood Discovered while dogfooding Winglang 🎨 sdk SDK

Comments

@skyrpex
Copy link
Contributor

skyrpex commented Nov 15, 2023

I tried this:

I tried using DynamoDB Streams with the ex.DynamoDBTable

This happened:

It wasn't possible since they aren't implemented

I expected this:

To be able to run code like the following:

bring ex;

let users = new ex.DynamodbTable();

user.onStream(inflight (event) => {
  log("${event.records.length} events changed");
});

Is there a workaround?

No response

Component

SDK

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Anything else?

No response

Community Notes

  • Please vote by adding a 👍 reaction to the issue to help us prioritize.
  • If you are interested to work on this issue, please leave a comment.
@skyrpex skyrpex added 🐛 bug Something isn't working 🎨 sdk SDK 🐶 dogfood Discovered while dogfooding Winglang labels Nov 15, 2023
@staycoolcall911
Copy link
Contributor

This will make for a better DX, but is not a must for wing cloud 1.0

@marciocadev
Copy link
Collaborator

I don't think it's possible to implement DynamoDB streams in the simulator the way it's currently built.

Currently, the DynamoDBTable uses amazon/dynamodb-local, causing the simulator to use a real DynamoDB container. However, DynamoDB streams need to connect to real Amazon resources, such as a Lambda function. The way it's currently done, I don't think it's possible to create streams in the simulator.

One possibility could be for the simulator to cease using Docker and instead create an implementation similar to what was done for cloud.Table, essentially a Map<string, any>.
Events could then be mapped in a manner similar to what was done for cloud.Bucket.

On the other hand, in tf-aws and aws-cdk, it's quite simple.

@ekeren
Copy link
Collaborator

ekeren commented Nov 20, 2023

@marciocadev , I've notice this https://stackoverflow.com/a/42185707

Is it relevant?

@marciocadev
Copy link
Collaborator

marciocadev commented Nov 20, 2023

I saw this @ekeren

Creating the Dynamo Stream wouldn't be the problem in the simulator. The issue is that, to consume it, a lambda would have to be used. Currently, the cloud.Function in the simulator doesn't create an AWS resource, as the DynamoDB simulator does.

I don't think it's possible to create the stream in the simulator the way it's currently built

@eladb
Copy link
Contributor

eladb commented Nov 23, 2023

From the aws docs it seems like it is supposed to be supported.

@skyrpex
Copy link
Contributor Author

skyrpex commented Nov 29, 2023

I saw this @ekeren

Creating the Dynamo Stream wouldn't be the problem in the simulator. The issue is that, to consume it, a lambda would have to be used. Currently, the cloud.Function in the simulator doesn't create an AWS resource, as the DynamoDB simulator does.

I don't think it's possible to create the stream in the simulator the way it's currently built

During this weekend, I recreated the DynamoDB Table resource in pure Wing to enable streams for the Simulator (it uses the dynamodb-local docker image, too). In order to fetch the records from the local stream, a long running cloud.Service can be used.

My code isn't ready to share just now but maybe I can create a small playground repository with what I have.

@skyrpex
Copy link
Contributor Author

skyrpex commented Nov 30, 2023

winglang/winglibs#26

Copy link

Hi,

This issue hasn't seen activity in 60 days. Therefore, we are marking this issue as stale for now. It will be closed after 7 days.
Feel free to re-open this issue when there's an update or relevant information to be added.
Thanks!

@github-actions github-actions bot added the Stale label Jan 30, 2024
skyrpex added a commit to winglang/winglibs that referenced this issue Mar 19, 2024
- Interface similar to the original DynamoDB SDK
- Includes streams support
- Uses one container for all tables (sim)

Closes winglang/wing#4949
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🐶 dogfood Discovered while dogfooding Winglang 🎨 sdk SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants