Home > Mobile >  Lambda in dev consuming event before test lambda
Lambda in dev consuming event before test lambda

Time:10-02

I have a quick question about an interesting "bug" I've been facing.

I have a rest api built with lambda. When I send a request to my application it will then push a file to an s3 bucket. That bucket has an event notification attached to it that will trigger my lambda to consume the event.

Because of future proofing I do not want to process the whole file at once. I need this additional consumer.

I already have a lambda1 that achieves this flow deployed in my dev environment. When I create a new stack in dev for validation before merging, let's call it lambda2, lambda1 consumes what get's put into the folder by lambda2. lambda2 also seems to start consuming this event, but lambda1 finishes first and deletes the file leaving lambda2 hanging.

I need lambda1 to stay live even when I'm validating lambda2.

Do y'all have any pointers on how I can achieve that?

CodePudding user response:

If I understand correctly, both lambda1 and lambda2 are triggered by the same S3 bucket. If you want to separate your environments, you should create a separate bucket for storing files in your production environment, otherwise, Lambda functions in both environments will be triggered.

CodePudding user response:

Instead of L1 deleting the file, you can slightly modify it to move the file on another bucket, and use this second bucket as trigger for L2. Once you are sure that L2 works, change it's trigger back to the original bucket and disable/delete L1 trigger.

  • Related