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: https://docs.aws.amazon.com/lambda/latest/dg/API_PublishLayerVersion.html 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:
provider:
name: aws
runtime: python3.8
lambdaHashingVersion: 20201221
region: us-west-1
stage: ${opt:stage, 'stage'}
deploymentBucket:
name: name.serverless.${self:provider.region}.deploys
deploymentPrefix: serverless
iamRoleStatements:
- Effect: Allow
Action:
- s3:PutObject
- s3:GetObject
Resource: "arn:aws:s3:::name.serverless.${self:provider.region}/*"
- Effect: Allow
Action:
- cloudformation:DescribeStacks
Resource: "*"
- Effect: Allow
Action:
- lambda:PublishLayerVersion
Resource: "*"
layers:
aws-abstraction-services-layer:
# 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"
compatibleRuntimes:
- python3.8
allowedAccounts:
- '*'
plugins:
- 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: https://pip.pypa.io/warnings/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/aws-services-layer-stage-python-default.zip (0.8 MB)
... ○ Uploading layer package...
... ○ OK...
ServerlessLayers error:
Action: Lambda:publishLayerVersion
Params: {"Content":{"S3Bucket":"name.serverless.us-west-1.deploys","S3Key":"serverless/aws-services-layer/stage/layers/aws-services-layer-stage-python-default.zip"},"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: