AWS-AMI-Automated-Creation-Deletion icon indicating copy to clipboard operation
AWS-AMI-Automated-Creation-Deletion copied to clipboard

Error

Open raakey opened this issue 7 years ago • 24 comments

Hi, iam very new to the Lambda, but when i execute your scripts in lambda, here iam getting the Error , please find below 2017-05-07T23:00:14.702Z e6ba23fe-3378-11e7-b141-6384f3daab93 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15)

raakey avatar May 08 '17 06:05 raakey

@raakey - did you setup the permissions

did you follow steps here https://www.webdigi.co.uk/blog/2017/aws-instance-automated-ami-creation-deletion-system/ to create this permissions https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/blob/master/roles/roles.json and then add that permission to Lambda?

It just looks like a permission issue.

webdigi avatar May 08 '17 06:05 webdigi

Yes i followed the same. AMI got deleted but Snapshots are still exist.

raakey avatar May 08 '17 09:05 raakey

how many EBS volumes were attached to the instances?

webdigi avatar May 08 '17 09:05 webdigi

Only One.

raakey avatar May 08 '17 09:05 raakey

can you please try another AMI. Looks like https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/blob/master/lambda/deleteAMI.js line 79 is not set.

Please paste the log lines above and below the ones you sent earlier also. We have multiple instances and they all work well as expected.

webdigi avatar May 08 '17 11:05 webdigi

Ok i will let u know that, thanks

raakey avatar May 08 '17 11:05 raakey

Logs FYI,

Logs FYI,

Time (UTC +00:00) Message 2017-05-07  23:00:02 START RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Version: $LATEST  23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 Time to delete ELK_204_70  23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 image that is going to be deregistered: ELK_204_70  23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 image id: ami-23f89035  23:00:04 2017-05-07T23:00:04.182Z e6ba23fe-3378-11e7-b141-6384f3daab93 { ImageId: 'ami-23f89035' }  23:00:04 2017-05-07T23:00:04.502Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70  23:00:04 2017-05-07T23:00:04.823Z e6ba23fe-3378-11e7-b141-6384f3daab93 Image Deregistered  23:00:14 2017-05-07T23:00:14.510Z e6ba23fe-3378-11e7-b141-6384f3daab93 Time to delete ELK_204_70  23:00:14 2017-05-07T23:00:14.510Z e6ba23fe-3378-11e7-b141-6384f3daab93 snap-0bb0a59e5a537b13c  23:00:14 2017-05-07T23:00:14.642Z e6ba23fe-3378-11e7-b141-6384f3daab93 snap-0fd68eb48398e2386  23:00:14 2017-05-07T23:00:14.702Z e6ba23fe-3378-11e7-b141-6384f3daab93 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15)  23:00:14 END RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93  23:00:14 REPORT RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Duration: 12409.69 ms Billed Duration: 12500 ms Memory Size: 128 MB Max Memory Used: 38 MB  23:00:14 RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Process exited before completing request  23:01:07 START RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Version: $LATEST  23:01:13 2017-05-07T23:01:13.302Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70  23:01:23 2017-05-07T23:01:23.606Z e6ba23fe-3378-11e7-b141-6384f3daab93 Not yet time to delete ELK_204_70  23:01:23 END RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93  23:01:23 REPORT RequestId: e6ba23fe-3378-11e7-b141-6384f3daab93 Duration: 15655.76 ms Billed Duration: 15700 ms Memory Size: 128

raakey avatar May 08 '17 11:05 raakey

ok, did you try the create and delete again?

Have you made any changes to the code?

webdigi avatar May 08 '17 11:05 webdigi

except region, haven't changed any thing, i just copy and pasted

raakey avatar May 08 '17 12:05 raakey

thanks, we could not replicate this issue at all. Very odd.

  1. Can you please send me a screenshot of the tags that are added to the instance. I just want to make sure none are missed.
  2. it will be helpful if you can please try a new instance.
  3. Do you have any permission restriction on this account or do you have root access?

webdigi avatar May 08 '17 15:05 webdigi

Ok, im going to try on another instance. i will send the logs again. Thanks for the reply

raakey avatar May 09 '17 04:05 raakey

TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15) 2017-05-18T23:00:54.054Z cf73cb83-3c1d-11e7-9030-e39ef6280ae5 TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15)

I tried on another Instances, Getting same problem,

raakey avatar May 19 '17 12:05 raakey

Sorry, we could not replicate the issue.

If possible can you please send us a screenshot

  1. The tags used in the instance instance-tags

  2. AMI name after the instance is created. ami-name

It might be best to run just the create script first and then send us the screenshot and run the delete script later.

webdigi avatar May 19 '17 13:05 webdigi

I have tried on another instance just now, with adding same tags to that, that was working fine and clearing all AMI's with snapshots, and which i created earlier (above screen shot). that was not working properly. it showing timeout error (earlier error code.).

raakey avatar May 19 '17 16:05 raakey

so did you fix it with a change? I assume you mentioned it worked?

webdigi avatar May 19 '17 16:05 webdigi

Nope, i have tried on some other instance with same Tags, but how its possible that, it is working fine on one machine and not working on other machine ????

changes i did. screenshot from 2017-05-19 22-09-33 instead of DATETODEL- i used "BackupAMIUid-". thats it, With this minimal changes one instance working perfectly, and other one not working.

raakey avatar May 19 '17 16:05 raakey

instead of DATETODEL- i used "BackupAMIUid-". thats it,

was that applied to both the create and delete lambda function?

webdigi avatar May 19 '17 16:05 webdigi

screenshot from 2017-05-19 22-32-04 Yes

raakey avatar May 19 '17 17:05 raakey

Thanks for that. It looks like a timeout. In the lambda script can you please check configuration and the timeout is set to 5 minutes? Related to issue #4.

webdigi avatar Jun 14 '17 05:06 webdigi

Yes 5 minutes, still getting problem.

On Wed, Jun 14, 2017 at 10:31 AM, Webdigi - Web Development < [email protected]> wrote:

Thanks for that. It looks like a timeout. In the lambda script can you please check configuration and the timeout is set to 5 minutes? Related to issue #4 https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/4.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/3#issuecomment-308320226, or mute the thread https://github.com/notifications/unsubscribe-auth/AXkVnKvT1VPNJu-AQjCWu5P8lPxjIOU2ks5sD2lCgaJpZM4NTiXx .

--

S Rakesh +91-8105209463

raakey avatar Jun 14 '17 05:06 raakey

I set timeout to 5 minutes. And again i getting that problem.snapshots deletion problem. TypeError: Cannot read property 'SnapshotId' of undefined at null._onTimeout (/var/task/index.js:76:73) at Timer.listOnTimeout (timers.js:92:15) I didn't change anything in code also.still i am getting that problem.Any suggestions plz....

kpavan93 avatar Aug 14 '18 09:08 kpavan93

I am also facing same issue. Any solutions to fix this issue.

Joshuapaul avatar Aug 15 '18 08:08 Joshuapaul

found another solution here "https://github.com/webdigi/AWS-AMI-Automated-Creation-Deletion/issues/4". I have updated my code and lets see how my job will go on sunday.

Joshuapaul avatar Aug 15 '18 08:08 Joshuapaul

@Joshuapaul There's been new commits from Dec 2018, and it addressed this issue for me.

HSkogmo avatar Feb 06 '19 09:02 HSkogmo