Hello,
Learning serverless and statemachines. Getting error as in topic: TypeError: Cannot read property ‘startsWith’ of undefined.
Below you can find mu yml definition. Hope someone can help.
service: state-machine
plugins:
- serverless-python-requirements
- serverless-iam-roles-per-function
- serverless-step-functions
- serverless-pseudo-parameters
custom:
pythonRequirements:
dockerizePip: non-linux
slim: true
zip: true
provider:
name: aws
runtime: python3.8
region: eu-central-1
stage: ${opt:stage, 'testing'}
timeout: 30
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
- lambda:InvokeAsync
Resource: "*"
package:
individually: true
exclude:
- node_modules/**
- .git/**
- .venv/**
functions:
process-purchase:
module: state-machine
memorySize: 128
stages:
- testing
- dev
handler: ProcessPurchase.process_purchase
process-refund:
module: state-machine
memorySize: 128
stages:
- testing
- dev
handler: ProcessRefund.process_refund
stepFunctions:
validate: true
stateMachines:
TransactionChoiceMachine:
name: ChoiceMachineTest-${self:provider.stage}
dependsOn: CustomIamRole
definition:
Comment: "Purchase refund choice"
StartAt: ProcessTransaction
States:
ProcessTransaction:
Type: Choice
Choices:
- Variable: "$.TransactionType"
StringEquals: "PURCHASE"
Next: PurchaseState
- Variable: "$.TransactionType"
StringEquals: "REFUND"
Next: RefundState
PurchaseState:
Type: Task
Resource:
Fn::GetAtt: [process-purchase, Arn]
End: true
RefundState:
Type: Task
Resourse:
Fn::GetAtt: [process-refund, Arn]
End: true