-3

I have implemented a simple lambda function which gets triggered whenever there is objected created on s3 bucket. Whenever an object is created on S3 the lambda gets triggered.However , once the lambda is triggered, the lambda keeps executing at a certain interval even if there is upload on S3 bucket. Any suggestions would be really helpful.

Vijayanath Viswanathan
  • 8,027
  • 3
  • 25
  • 43
heisenberg
  • 139
  • 1
  • 12
  • Can you share some code and/or the command how you created the Lambda function? – Istvan Oct 30 '17 at 10:16
  • Its a simple aws function which gets triggered on a object created on s3 bucket I have just kept a logger var awsIot = require('aws-iot-device-sdk'); var publishCount = 0; console.log("########################"+publishCount); exports.handler = (event, context, callback) => { console.log("@@@@@@@@@@@@@@@@@@@@"); }; – heisenberg Oct 30 '17 at 10:38
  • 1
    Please add the function code by editing the question. Note that if your function writes to the same bucket, you would expect to have an infinite loop. – Michael - sqlbot Oct 30 '17 at 10:54
  • My function is not writing to the same bucket – heisenberg Oct 30 '17 at 10:55
  • There is a timeout error 'Task timed out after 300.02 seconds ' due to which the lambda is executing again . – heisenberg Oct 31 '17 at 05:13

1 Answers1

0

Your function is timing out because you aren't calling the callback or using the context.succeed() method. I believe retry is two with backoff for errors, but with timeout, S3 will keep retrying for a period of time that is not guaranteed but is usually quite long (a day?)

Doug Moscrop
  • 4,479
  • 3
  • 26
  • 46