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

AWS bucket notification events don't differ create and update one. #2724

Open
tsuf239 opened this issue May 31, 2023 · 5 comments
Open

AWS bucket notification events don't differ create and update one. #2724

tsuf239 opened this issue May 31, 2023 · 5 comments
Labels
🐛 bug Something isn't working 🎨 sdk SDK

Comments

@tsuf239
Copy link
Collaborator

tsuf239 commented May 31, 2023

I tried this:

let b = new cloud.Bucket();

b.onCreate(inflight () => {
    log ("CREATED");
});

b.onUpdate(inflight () => {
    log ("UPDATED");
});

test "test" {
    b.put("a", "1");
    b.put("a", "2");
}

This happened:

"CREATED" is logged twice.

We are using the "putObjectCommand" both for uploading and updating a key. This will always result in a PUT event (https://stackoverflow.com/questions/53421520/objectcreatedpost-on-s3-console-upload).
it seems like the only way to get a POST event is to do it via the browser, there is no equivalent command in @aws-sdk/client-s3, unfortunately.

I also looked at the notification payload, there is nothing that differentiates one from the other.

We may be able to conclude what kind of event is sent by looking at the object versioning.

On the other hand, if it's a necessary feature- we could find a workaround and gain a lot of users 😊

I expected this:

"CREATED" to be logged once, and "UPDATED" to be logged once.is

Is there a workaround?

No response

Component

SDK

Wing Version

0.17.43

Wing Console Version

No response

Node.js Version

No response

Platform(s)

MacOS

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.
@tsuf239 tsuf239 added the 🐛 bug Something isn't working label May 31, 2023
mergify bot pushed a commit that referenced this issue Jun 20, 2023
* Adding a second argument (event type) for bucket.onEvent, so now it's aligned to the spec (fixes #192, but not systemically)
* Improving `bucket/events.w`  test
* Adding an example for functions that return functions
* Exposing a severe error in aws events- #2724 


### <samp>🤖 Generated by Copilot at 7bfe8d9</samp>

This pull request adds and updates several examples and tests for Wing, especially related to bucket events and functions as values. It also modifies the `convertBetweenHandlers` function and the `BucketEventHandlerClient` class to support passing additional arguments to handler clients. It updates the snapshots to reflect the changes in the examples, tests, and compilation output.

___
## Checklist

- [x] Title matches [Winglang's style guide](https://docs.winglang.io/contributors/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
eladb pushed a commit that referenced this issue Jun 22, 2023
* Adding a second argument (event type) for bucket.onEvent, so now it's aligned to the spec (fixes #192, but not systemically)
* Improving `bucket/events.w`  test
* Adding an example for functions that return functions
* Exposing a severe error in aws events- #2724

This pull request adds and updates several examples and tests for Wing, especially related to bucket events and functions as values. It also modifies the `convertBetweenHandlers` function and the `BucketEventHandlerClient` class to support passing additional arguments to handler clients. It updates the snapshots to reflect the changes in the examples, tests, and compilation output.

___

- [x] Title matches [Winglang's style guide](https://docs.winglang.io/contributors/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://docs.winglang.io/terms-and-policies/contribution-license.html)*.
mergify bot pushed a commit that referenced this issue Jul 12, 2023
## Description
Finally closes #2114 !!
1. handled tests: 
* hidden: api/ delete, patch, option, get, put, post - #3342
* hidden: bucket/events - #2724
* hidden: queue/timeout - #3354 
* fixed: counter/dec - there was a bug working with both key and initial key different than 0
* fixed: function/memory_and_env- adjusted test
* fixed: function/timeout- adjusted test
* fixed- table/add_row - the key wasn't saved in the object when adding a key on preflight on sim, fixed and adjusted test
* fixed - website/website - adjusted test
* fixed - util/env- adjusted test, since utils.env is working, it is just that the meta comments aren't followed when using the cli and not hangar

2. Run build to generate new snapshots
3. edited the compatibility matrix - leftover tests detected: #3358
 
## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [x] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Monada Contribution License](https://www.winglang.io/terms-and-policies/contribution-license.html)*.
@github-actions
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 Jul 31, 2023
@tsuf239 tsuf239 removed the Stale label Aug 1, 2023
@github-actions
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 Oct 20, 2023
@tsuf239 tsuf239 removed the Stale label Oct 22, 2023
@garysassano
Copy link
Collaborator

Closing this since I've just tested the code and it works as expected now.

@tsuf239
Copy link
Collaborator Author

tsuf239 commented Oct 22, 2023

It may work on sim, but still doesn't work in AWS:
image
(To test this issue properly, please remove the condition here and run the test on aws)
Thank you once again @garysassano, for making us write our issues in a clearer way, keep up your great work! 💪 🚀 🦸

@tsuf239 tsuf239 reopened this Oct 22, 2023
Copy link

Hi,

This issue hasn't seen activity in 90 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working 🎨 sdk SDK
Projects
Status: 🤝 Backlog - handoff to owners
Development

No branches or pull requests

3 participants