Skip to content

arm functions use wrong layer #2

@franco-bildungsfinder

Description

@franco-bildungsfinder

Hi

Happy new year! It's me again :-).

I tried to use arm functions, but the lambdas are created with the x86 layers.

What I tried:

new PhpFpmFunction(this, 'Function',{
           .....
            phpVersion: '8.1',
            architecture: Architecture.ARM_64,
});

and the created lambda has the x86 layer.

I think the problem is that in in defaults.ts platform is hardcoded to x86 and in PhpFunction.ts (https://github.com/brefphp/constructs/blob/main/src/function/PhpFunction.ts#L47) the value from the defaults.ts is used to lookup the layer ARN without allowing to overwrite it.
Also the "official" property in FunctionProps in the cdk is called architecture (https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.FunctionProps.html#architecture). Would probably make sense to use the same name here.

The good news is, if I use the above code and manually change the layer to the arm layer, things work perfectly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions