Can no longer reference layer in same service as function
Opened this issue · 0 comments
andrewchernow commented
Are you certain it's a bug?
- Yes, it looks like a bug
Is the issue caused by a plugin?
- It is not a plugin issue
Are you using the latest v3 release?
- Yes, I'm using the latest v3 release
Is there an existing issue for this?
- I have searched existing issues, it hasn't been reported yet
Issue description
The serverless layer documentation explains how to reference a layer in same service as a function.
layers:
test:
path: layer
functions:
hello:
handler: handler.hello
layers:
- !Ref TestLambdaLayer
This no longer works since the generated CF template appends a hash to the name
TestLambdaLayeraece44dc10ace0f99712d88cd8dfcb75f0770f49
Service configuration (serverless.yml) content
org: sanford-and-son
app: boo
service: tools
frameworkVersion: ^3.38.0
configValidationMode: error
deprecationNotificationMode: warn:summary
params:
default:
func_dir: src/functions
artifact_dir: ./.artifacts
provider:
name: aws
stage: ${opt:stage, 'local'}
runtime: nodejs20.x
architecture: arm64
stackName: boo-${self:service}
deploymentMethod: direct
logs:
httpApi: true
logRetentionInDays: 180
deploymentPrefix: serverless
deploymentBucket:
name: boo-${self:provider.stage}-${aws:region}
package:
individually: true
excludeDevDependencies: true
layers:
chromium:
name: chromium
description: Chromium headless browser
retain: true
compatibleRuntimes:
- nodejs20.x
compatibleArchitectures:
- x86_64
package:
artifact: ./chromium-v122.0.0-layer.zip
functions:
boo-html-to-pdf:
handler: ${param:func_dir}/html-to-pdf/entry.handler
name: boo-html-to-pdf
description: Converts HTML to PDF Documents
runtime: nodejs20.x
architecture: x86_64 # chromium doesn't support arm64 yet
timeout: 300
memorySize: 2048
package:
artifact: ${param:artifact_dir}/html-to-pdf.zip
layers:
- !Ref ChromiumLambdaLayer
resources:
Description: 'my stack description'
Command name and used flags
serverless deploy --stage dev --force
Command output
The CloudFormation template is invalid: Template format error: Unresolved resource dependencies [TestLambdaLayer] in the Resources block of the template
Environment information
Running "serverless" from node_modules
Framework Core: 3.38.0 (local) 3.38.0 (global)
Plugin: 7.2.0
SDK: 4.5.1