serverless-aws-alias icon indicating copy to clipboard operation
serverless-aws-alias copied to clipboard

S3 events not correctly delegated to the aliased functions

Open HyperBrain opened this issue 6 years ago • 5 comments

If you add a S3 event to your service the event will trigger the $LATEST version instead of the deployed alias.

Expectation: The trigger should call func:alias.

HyperBrain avatar Sep 20 '17 14:09 HyperBrain

Bug, because it is not yet handled -> Feature, because the solution will/must lead to per-alias buckets if buckets emit S3 events. Otherwise an uncontrolled trigger of all deployed aliases would happen.

HyperBrain avatar Sep 20 '17 16:09 HyperBrain

@HyperBrain would like to help with this feature but not sure where to start. Could you provide any direction? Thanks.

justinffs avatar Nov 09 '17 04:11 justinffs

@justinffs In general, the S3 triggers should be handled in the plugin in a similar way as the other event triggers (the code is located in the stackOps folder). I think they move the trigger and the trigger permission resources to the alias stack and replace the function references with the alias references (ref to the alias resource). So you'd have to copy one of the other event stackops and change it to use the S3 trigger resources. Then add the stackOp to the general execution order (somewhere near the others).

I'm quite sure that the same handling applied to S3 triggers would work like everything else. Of course we have to do some testing to see if there are not any side effects that are special in the S3 environment.

... and thanks for your help. I'm glad that I get some help here 👍

HyperBrain avatar Nov 09 '17 10:11 HyperBrain

In the end we have to check if my comment above (https://github.com/HyperBrain/serverless-aws-alias/issues/73#issuecomment-330912022) is valid or not (the per alias bucket). Maybe it's not valid.

HyperBrain avatar Nov 09 '17 10:11 HyperBrain

hey was there anything new on this issue?

pohes avatar Jul 15 '18 09:07 pohes