By using AWS re:Post, you agree to the Terms of Use

CodeBuild failing with invalidParameterError on build with a valid parameter given


I'm trying to create a lambda layer in serverless and have it deploy to AWS creating the lambda layer for use in other deployments.

However I'm running into an issue where the "Lambda:PublishLayerVersion" is failing because of CompatibleArchitectures. I'm wondering if its possible that there was a mistake that I'm missing or its serverless having an issue because Action is using a lowercase 'p' for "Lambda:publishLayerVersion" when the docs here: states it is "Lambda:PublishLayerVersion".

It is also likely that the SDK error is legitimate that the param "CompatibleArchitectures" isn't supported in "us-west-1" but I have a hard time finding docs to tell me what is supported in different regions.

serverless.yml Spec:

  name: aws
  runtime: python3.8
  lambdaHashingVersion: 20201221
  region: us-west-1
  stage: ${opt:stage, 'stage'}
    name: name.serverless.${self:provider.region}.deploys
  deploymentPrefix: serverless
    - Effect: Allow
        - s3:PutObject
        - s3:GetObject
      Resource: "arn:aws:s3:::name.serverless.${self:provider.region}/*"
    - Effect: Allow
        - cloudformation:DescribeStacks
      Resource: "*"
    - Effect: Allow
        - lambda:PublishLayerVersion
      Resource: "*"

    # name: aws-abstraction-services-layer
    path: aws-abstraction-layer
    description: "This is the goal of uploading our abstractions to a layer to upload and use to save storage in deployment packages"
      - python3.8
      - '*'

  - serverless-layers
  - serverless-python-requirements

Output of build log

[Container] 2022/04/12 17:14:41 Running command serverless deploy
Running "serverless" from node_modules

Deploying aws-services-layer to stage stage (us-west-1)

[ LayersPlugin ]: => default
... ○ Downloading requirements.txt from bucket...
... ○ requirements.txt The specified key does not exist..
... ○  Changes identified ! Re-installing...
... ○ pip install -r requirements.txt -t . 
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
aws-sam-cli 1.40.1 requires requests==2.25.1, but you have requests 2.27.1 which is incompatible.
WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv:
WARNING: You are using pip version 21.1.2; however, version 22.0.4 is available.
You should consider upgrading via the '/root/.pyenv/versions/3.8.10/bin/python3.8 -m pip install --upgrade pip' command.
Collecting requests
  Downloading requests-2.27.1-py2.py3-none-any.whl (63 kB)
Collecting charset-normalizer~=2.0.0
  Downloading charset_normalizer-2.0.12-py3-none-any.whl (39 kB)
Collecting certifi>=2017.4.17
  Downloading certifi-2021.10.8-py2.py3-none-any.whl (149 kB)
Collecting idna<4,>=2.5
  Downloading idna-3.3-py3-none-any.whl (61 kB)
Collecting urllib3<1.27,>=1.21.1
  Downloading urllib3-1.26.9-py2.py3-none-any.whl (138 kB)
Installing collected packages: urllib3, idna, charset-normalizer, certifi, requests
Successfully installed certifi-2021.10.8 charset-normalizer-2.0.12 idna-3.3 requests-2.27.1 urllib3-1.26.9

... ○ Created layer package /codebuild/output/src847310000/src/.serverless/ (0.8 MB)
... ○ Uploading layer package...
... ○ OK...
ServerlessLayers error:
    Action: Lambda:publishLayerVersion
    Params: {"Content":{"S3Bucket":"","S3Key":"serverless/aws-services-layer/stage/layers/"},"LayerName":"aws-services-layer-stage-python-default","Description":"created by serverless-layers plugin","CompatibleRuntimes":["python3.8"],"CompatibleArchitectures":["x86_64","arm64"]}
AWS SDK error:
    CompatibleArchitectures are not supported in us-west-1. Please remove the CompatibleArchitectures value from your request and try again

[Container] 2022/04/12 17:14:47 Command did not exit successfully serverless deploy exit status 1
[Container] 2022/04/12 17:14:47 Phase complete: BUILD State: FAILED
[Container] 2022/04/12 17:14:47 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: serverless deploy. Reason: exit status 1
[Container] 2022/04/12 17:14:47 Entering phase POST_BUILD
[Container] 2022/04/12 17:14:47 Phase complete: POST_BUILD State: SUCCEEDED
[Container] 2022/04/12 17:14:47 Phase context status code:  Message: 
1 Answer

The failure is caused neither by AWS CodeBuild nor by serverless. This error message originates from the AWS Lambda service. For some regions, the support of arm64 architecture has not been activated yet. You can contact AWS Support for details.

You can also read this blog post.

You can use Lambda Functions powered by Graviton2 processor today in US East (N. Virginia), US East (Ohio), US West (Oregon), Europe (Frankfurt), Europe (Ireland), EU (London), Asia Pacific (Mumbai), Asia Pacific (Singapore), Asia Pacific (Sydney), Asia Pacific (Tokyo).

profile picture
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions