I’m attempting to push a lambda layer stack.
My code, more-or-less following the official tutorial here:
My code looks like this:
service: ffmpeg
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs14.x
region: us-east-1
stage: dev
lambdaHashingVersion: 20201221
functions:
mkgif:
handler: handler.mkgif
events:
- s3:
bucket: my-bucket-name-here-foo-foo
event: s3:ObjectCreated:*
existing: true
rules:
- suffix: .mp4
- prefix: test/
layers:
- {Ref: FfmpegLambdaLayer}
layers:
ffmpeg:
path: layer/ffmpeg
My file structure looks like this:
ffmpeg -
-- layer
-- ffmpeg
-- *all the binaries and other files for ffmpeg
-- handler.js
-- .npmignore
-- serverless.yml
Of note, when I deploy this, the uploaded zip package is ~2kb. When I go to the layer in the AWS console, the layer zip is also small and only contains the handler.js file and the .npmignore file.
The weird part is… if I comment out the functions area in my serverless.yml file, so my code looks like this:
service: ffmpeg
frameworkVersion: '2'
provider:
name: aws
runtime: nodejs14.x
region: us-east-1
stage: dev
lambdaHashingVersion: 20201221
layers:
ffmpeg:
path: layer/ffmpeg
… THEN deploy… I get a 65mb zip file and a full-sized lambda layer in the AWS console, with the expected files.
Uh… why? How can I deploy a function AND the layer?