lambda layers per stage in config not working
Hi, I'm Ssoonan.
"stages": {
"dev": {
"api_gateway_stage": "api" ,
"lambda_timeout": 300,
"lambda_memory_size": 512,
"layers": [
"arn:aws:lambda:~",
"arn:aws:lambda:~"
]
}
}
I put Lambda layers in ./chalice/config.json
When I deployed my project, everything works fine and no errors occured.
But layers config doesn't working, So I had to do it on the console manually.
Thanks for your project and help. Thank you
Hi, I am having the same problem here.
I was not able to reproduce. Using this app.py with an empty requirements.txt:
from chalice import Chalice
import PIL
import aiohttp
app = Chalice(app_name='layers')
@app.lambda_function()
def version(event, context):
return {
'Pilow': PIL.__version__,
'aiohttp': aiohttp.__version__
}
and these public layers in my .chalice/config.json:
{
"stages": {
"dev": {
"api_gateway_stage": "api",
"layers": [
"arn:aws:lambda:us-west-2:113088814899:layer:Klayers-python37-Pillow:1",
"arn:aws:lambda:us-west-2:113088814899:layer:Klayers-python37-aiohttp:5"
]
}
},
"version": "2.0",
"app_name": "layers"
}
I was able to chalice deploy and then invoke it fine:
$ chalice invoke -n version
{"Pilow": "5.4.1", "aiohttp": "3.5.4"}
What version of chalice are you using? In order to use layers, you need to be using version 1.7.0.
@kyleknap I have the same issue. Can it be because I didn't recreate my already deployed Chalice app but just run chalice deploy?
@kyleknap I've done chalice delete and chalice deploy - no luck still. I have the following part in config and I can confirm that lambda_timeout parameter works just perfect, while layers param does not.
"lambda_functions": {
"api_handler": {
"lambda_timeout": 300,
"layers": [
"arn:aws:lambda:us-east-1:12345678:layer:pycryptodome:1",
"arn:aws:lambda:us-east-1:12345678:layer:paypal-checkout-serversdk:1"
]
}
},
@danil-smirnov What version of chalice are you using? You can get the version by running chalice --version.
@kyleknap
chalice --version
chalice 1.7.0, python 3.6.8, linux 4.14.88-72.73.amzn1.x86_64
So looking over the tags, it looks like layers has not actually been included in a official chalice release. It is currently on the master branch though, which is why it is showing up in the documentation (we always build the docs from the head of the master branch). It was working for me because I have chalice installed from the head of master as well. I will look into cutting a release for chalice so it is available on PyPI. Otherwise, you should be able to install it from the master branch in the meantime to try it out by running:
pip install -e git://github.com/aws/chalice.git@master#egg=chalice
We just released chalice 1.8.0 to PyPI. You should be able to install it now and use layers with chalice. Let us know if you run into any issues.
Everything works like a charm now @kyleknap Many thanks
Everything works fine now. Thanks guys
Awesome. Great to hear! Closing.