How to remove an existing lambda from aws greengrass?

1.1k Views Asked by At

I tried to remove Greengrass version lambda from Greengrass, it complains me with,

We cannot deploy because the group definition is invalid or corrupted for the following reasons: {ErrorSet(errorSet=[ErrorModel(errorCode=REFERENTIAL_INTEGRITY_ERROR, errorMsg=Source arn:aws:lambda:us-east-1:xxx:function:xxx:2 does not exist in group)])}
"Source arn:aws:lambda:us-east-1:xxx:function:xxx:2 does not exist in group"

I understand we need to use ALIAS instead of version, but if that is the case AWS IOT should not allow that.

Updated the code, added the new version and I could not remove the old version.

2

There are 2 best solutions below

0
On

I had a similar error message when trying to replace a Lambda function. In the end the problem was the subscription referring to that function. Try removing any subscription having source or target as the lambda that causes problems.

1
On

You'll need to remove all subscriptions referencing to the lambda. In doing so you'll need to update the definitions as they mention in the error.

Doing so in AWS' graphical console is relatively easy. Through command line is very lengthy process however. To do it through command line, you'll want to query the group, to get all of the definitions/versions, update the subscriptions, get the new definitions for that, and modify the original group with the new def from the subscriptions and deploy that.

It's a bit messy and took me a while to figure out.