serverless-operations/serverless-lambda-edge-pre-existing-cloudfront

InvalidLambdaFunctionAssociation: The function ARN must reference a specific function version

Closed this issue · 1 comments

I tried following the documentation for the simple case of adding a trigger to an existing CF distribution. During deployment I'm getting this message:

The function ARN must reference a specific function version. (The ARN must end with the version number.)

The ARN that is being set ends with $LATEST which is an alias, and seems to be unsupported by CloudFront:

arn:aws:lambda:eu-central-1:XXXX:function:XXXX-generateSitemap:$LATEST

What am I doing wrong here?
Btw, I get the exact same message if I manually try to set this ARN by editing the CloudFront distribution in the CF console.

In case someone encounters this in the future:

I noticed the plugin code does have a function that looks for the latest version number. However my serverless.yml had this line:

versionFunctions: false

Which always leaves only the $LATEST version. Changing this value to true fixed the problem.