serverless-heaven / serverless-aws-alias

Alias support for Serverless 1.x
MIT License
189 stars 68 forks source link

S3 events not correctly delegated to the aliased functions #73

Open HyperBrain opened 7 years ago

HyperBrain commented 7 years ago

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 commented 7 years ago

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.

justinffs commented 7 years ago

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

HyperBrain commented 7 years ago

@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 commented 7 years ago

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.

pohes commented 6 years ago

hey was there anything new on this issue?