serverless-step-functions
serverless-step-functions copied to clipboard
Step functions are not updated when useExactVersion is true and lambda layers are updated
This is a Bug Report
Description
What went wrong?
I have a step function that calls a lambda function (python 3.8) which uses a layer (which contains a couple of python modules). All 3 resources are defined in the same serverless service. I use the useExactVersion: true
to make the step function depend on the specific (latest) version of lambda function.
When I update some code in the layer (like adding a comment, for example) and run deployment my lambda function gets updated to use the updated version of the layer, but the step function still uses the previous version of the lambda function.
So, basically, when I run the lambda function itself, the latest version gets executed. But when I run the step function, the previous version of the lambda function gets executed.
It seems like the plugin (or serverless framework - I'm not sure) doesn't detect transitive dependencies or something like that.
What did you expect should have happened?
I expected the step function to execute the latest version of the lambda function once deployment is done.
I found the issue when I fixed a bug in the shared code in the layer but the bug still wasn't fixed when I executed the step function. I was able to force serverless to update the step function by changing something in the definition of the step function (like changing dependsOn
section) and by changing something directly in the code of the lambda function. But any changes to the layer seems to be invisible to the step function.
What was the config you used?
service: my-service-name
frameworkVersion: ">=1.34.0 <2.0.0"
plugins:
- serverless-step-functions
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
layer:
name: python-requirements-layer
description: Python requirements for the calculation
compatibleRuntimes:
- python3.8
provider:
name: aws
stage: ${opt:stage, 'dev'}
runtime: python3.8
layers:
utils:
name: python-utils-layer
description: Common utils for all Lambda function in the project
path: layers/utils_lambda_layer
compatibleRuntimes:
- python3.8
functions:
myLambdaFunction:
name: my-lambda-function
handler: my_lambda_function.handler.lambda_handler
layers:
- Ref: PythonRequirementsLambdaLayer
- Ref: UtilsLambdaLayer
stepFunctions:
stateMachines:
myStepFunction:
name: my-step-function
role: some-predefined-role-arn
useExactVersion: true
definition:
StartAt: FirstState
States:
FirstState:
Type: Task
Resource:
Fn::GetAtt: [myLambdaFunction, Arn]
Parameters:
some.$: $.some
inputs.$: $.inputs
ResultPath: $.my_resules
Next: SomeOtherStep
# Some other steps...
dependsOn:
- MyLogsGroup
loggingConfig:
level: ALL
includeExecutionData: true
destinations:
- Fn::GetAtt: [MyLogsGroup, Arn]
validate: true
resources:
Resources:
MyLogsGroup:
Type: AWS::Logs::LogGroup
Properties:
LogGroupName: /aws/stepfunction/my-log-group
What stacktrace or error message from your provider did you see?
There were no error messages from the provider.
Additional Data
-
Serverless Framework Core Version you're using: Framework Core: 1.73.1 (standalone) Plugin: 3.6.13 SDK: 2.3.1 Components: 2.30.15
-
The Plugin Version you're using: "devDependencies": { "serverless-python-requirements": "^5.1.1", "serverless-step-functions": "^2.32.0" }
-
Operating System: Xubuntu based on Ubuntu 20.04.2 LTS
-
Stack Trace: None
-
Provider Error messages: None
I am having the same error