-
Notifications
You must be signed in to change notification settings - Fork 35
Description
Currently our publishing of extension layers do not specify the compatible architecture. That looks like this in the AWS console:
The result is that one can accidentally select an incompatible ARN from the releases table and the suggested "Verify" in the AWS Console won't help. This causes a somewhat obvious error when attempting to run or test the function directly, you get this response:
{
"errorMessage": "RequestId: 2770acd9-e8b3-4043-b246-d68fbeb94f02 Error: fork/exec /opt/extensions/apm-lambda-extension: exec format error",
"errorType": "Extension.LaunchError"
}
and a similar error message in the logs.
However, if the function is being invoked by some trigger, e.g. API Gateway, it is less obvious what is wrong:
% curl -i https://REDACTED.execute-api.us-west-2.amazonaws.com/defaulttrentstage/trentm-play-fn1
HTTP/2 500
date: Sat, 05 Mar 2022 00:11:57 GMT
content-type: application/json
content-length: 35
apigw-requestid: Oe-gHhxsvHcESMg=
{"message":"Internal Server Error"}
Adding this should just mean adding --compatible-architectures "$(ARCHITECTURE)"
to the aws lambda publish-layer-version
call here:
apm-aws-lambda/apm-lambda-extension/Makefile
Lines 59 to 67 in eb3f041
# Publish the given LAYER in the given AWS region | |
publish: validate-layer-name validate-aws-default-region | |
@aws lambda \ | |
--output json \ | |
publish-layer-version \ | |
--layer-name "$(ELASTIC_LAYER_NAME)-$(ARCHITECTURE)" \ | |
--description "AWS Lambda Extension Layer for Elastic APM $(ARCHITECTURE)" \ | |
--license "Apache-2.0" \ | |
--zip-file "fileb://./bin/extension.zip" |