in index.js [93:131]
async generateLayerARN(version, architecture) {
const region = this.provider.getRegion();
if (version) {
try {
let layerVersionInfo;
if (architecture === 'arm64' || this.provider.architecture === 'arm64') {
layerVersionInfo = await this.provider.request('Lambda', 'getLayerVersionByArn', {
Arn: `arn:aws:lambda:${region}:580247275435:layer:LambdaInsightsExtension-Arm64:${version}`,
});
} else {
layerVersionInfo = await this.provider.request('Lambda', 'getLayerVersionByArn', {
Arn: `arn:aws:lambda:${region}:580247275435:layer:LambdaInsightsExtension:${version}`,
});
}
return layerVersionInfo.LayerVersionArn;
} catch (err) {
if (err.code==='AccessDeniedException') {
throw new Error(
`LambdaInsights layer version '${version}' ` +
`does not exist within your region '${region}'.`);
} else {
throw err;
}
}
}
let arn;
if (architecture === 'arm64' || this.provider.architecture === 'arm64') {
arn = layerVersionsArm64[region];
} else {
arn = layerVersions[region];
}
if (!arn) {
throw new Error(
`Unknown latest version for region '${region}'. ` +
`Check the Lambda Insights documentation to get the list of currently supported versions.`);
}
return arn;
};