0

I am resizing image on AWS lambda by using JIMP and if image is large 2MB+ it fails by time out when I am getting buffer:

 const img = await jimp.read(buff);
 await img.resize(jimp.AUTO, 512);
 const imgBuff = await img.getBufferAsync(mime); // here, Lambda fails with timeout
John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Ted
  • 1,682
  • 3
  • 25
  • 52

1 Answers1

1

Have you tried increasing the timeout from its default? The default Lambda timeout is 3 seconds, and you can increase this to a maximum of 900 seconds. Open your Lambda function "Configuration" and go to "Basic settings". Edit the Lambda timeout ("Edit" button top right)

enter image description here

Note that this affects the cost.

Another option is to orchestrate your Lambda using AWS Step Function in which you can control the timeout, which would be ideal if you have multiple Lambdas.

user2210411
  • 1,497
  • 1
  • 9
  • 7