Obsolete `DependsOn` with Lambda functions
See original GitHub issueBug Report
Description
Lambda functions have an obsolete DependsOn
resource.
-
What did you do? I ran the
sls package
command -
What happened? A
cloudformation-template-update-stack.json
was generated with
"NylasLambdaFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": "removed",
"S3Key": "removed"
},
"FunctionName": "removed",
"Handler": "functions/nylas/index.handler",
"MemorySize": 1024,
"Role": {
"Fn::GetAtt": [
"IamRoleLambdaExecution",
"Arn"
]
},
"Runtime": "nodejs12.x",
"Timeout": 600,
"TracingConfig": {
"Mode": "Active"
},
"Environment": {
"Variables": {
"NYLAS_APP_ID": "missing_NYLAS_APP_ID",
"NYLAS_APP_SECRET": "missing_NYLAS_APP_SECRET"
}
}
},
"DependsOn": [
"NylasLogGroup",
"IamRoleLambdaExecution" # Issue is here, this isn't required because dependency is enforced by "Fn:GetAtt"
]
},
- What should’ve happened?
"NylasLambdaFunction": {
"Type": "AWS::Lambda::Function",
"Properties": {
"Code": {
"S3Bucket": "removed",
"S3Key": "removed"
},
"FunctionName": "removed",
"Handler": "functions/nylas/index.handler",
"MemorySize": 1024,
"Role": {
"Fn::GetAtt": [
"IamRoleLambdaExecution",
"Arn"
]
},
"Runtime": "nodejs12.x",
"Timeout": 600,
"TracingConfig": {
"Mode": "Active"
},
"Environment": {
"Variables": {
"NYLAS_APP_ID": "missing_NYLAS_APP_ID",
"NYLAS_APP_SECRET": "missing_NYLAS_APP_SECRET"
}
}
},
"DependsOn": [
"NylasLogGroup",
# Remove the IamRoleLambdaExecution depedency
]
},
- What’s the content of your
serverless.yml
file?
service: ${self:custom.project.name}
package:
individually: true
provider:
name: aws
tracing:
lambda: true
versionFunctions: false
stage: ${file(./serverless.js):provider.stage}
stackName: ${file(./serverless.js):project.stackName}
runtime: ${file(./serverless.js):provider.runtime}
region: ${file(./serverless.js):provider.region}
logRetentionInDays: ${file(./serverless.js):provider.logRetentionInDays}
deploymentBucket:
name: ${file(./serverless.js):provider.deploymentBucket.name}
iamRoleStatements: # permissions for all of your functions can be set here
- Effect: 'Allow'
Action:
- 's3:*'
Resource: '*'
- Effect: 'Allow'
Action:
- 'dynamodb:*'
Resource: '*'
plugins:
- '@dathuis/serverless-stack-output'
- serverless-webpack
- serverless-offline
custom:
project: ${file(./serverless.js):project}
webpack:
webpackConfig: 'webpack.config.js'
includeModules:
packagePath: '../../package.json'
forceExclude:
- aws-sdk
packager: 'npm'
functions:
nylas:
handler: functions/nylas/index.handler
environment:
NYLAS_APP_ID: ${env:NYLAS_APP_ID, 'missing_NYLAS_APP_ID'}
NYLAS_APP_SECRET: ${env:NYLAS_APP_SECRET, 'missing_NYLAS_APP_SECRET'}
memorySize: 1024
timeout: 600
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
DependsOn attribute - AWS CloudFormation
Specify that the creation of a specific resource depends on another resource in CloudFormation with the DependsOn attribute.
Read more >How do you "DependsOn" a Lambda function from a CFN ...
The DependsOn attribute should have the logical name of the Lambda Function in the Cloud formation template not the ARN of Lambda Function....
Read more >AWS Lambda Functions - Serverless Framework
By default, Lambda allocates 512 MB of ephemeral storage in functions under the /tmp directory. You can increase its size via the ephemeralStorageSize...
Read more >aws.lambda.Function - Pulumi
Documentation for the aws.lambda.Function resource with examples, input properties, output properties, lookup functions, and supporting types.
Read more >Config Rules: Outdated AMI Check - A Secure Cloud
This configuration will create a Lambda Function for the Custom Config ... 300 DependsOn: "LambdaIamRoleCustomConfigRule" LambdaIamRoleCustomConfigRule: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This does trigger W3005 on cfn-lint: https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/rules.md
Would be nice if serverless passed all the errors and warnings for cfn-lint by itself. We run cfn-lint on the generated stack to make sure our custom CFN code isn’t broken, so this does generate a decent bit of noise. Not sure how to lint just the custom resources.
will work on it