问题描述
文件上传到S3存储桶后,我正在尝试启动AWS State Machine(步进功能)。 存储桶已经存在,并且已使用Serverless Framework创建了项目。
为此,我在serverless.yml中创建了此功能
functions:
imagewasuploadedevent:
handler: src/stepfunctions/imageWasuploadedEvent.handler
events:
- s3:
bucket: !Ref AttachmentsBucket
existing: true
iamRoleStatements:
- Effect: "Allow"
Action:
- "states:StartExecution"
Resource:
- "*"
当文件上传到已经存在的S3存储桶“ AttachmentsBucket”中并且希望它启动状态机处理时,应该触发该功能
现在“步进功能”定义在下面
stepFunctions:
stateMachines:
ValidateImageStateMachine:
deFinition:
Comment: "This state function validates the images after users upload them to S3"
StartAt: imagewasuploadedevent
States:
imageWasuploadedEvent:
Type: Task
Resource:
Fn::GetAtt: [imagewasuploadedevent,Arn]
End: true
plugins:
- serverless-python-requirements
- serverless-iam-roles-per-function
- serverless-step-functions
An error occurred:
ValidateImageStateMachinestepFunctionsstateMachine - Invalid State Machine
DeFinition: 'MISSING_TRANSITION_TARGET: Missing 'Next' target: imagewasuploadedevent at /StartAt,MISSING_TRANSITION_TARGET: State "imageWasuploadedEvent" is not reachable. at /States/imageWasuploadedEvent' (Service: AWsstepFunctions; Status Code: 400; Error Code: InvalidDeFinition; Request ID: 39217fe8-9dcd-4386-8549-b995619d2db6; Proxy: null).
我怀疑这与我正在做的事情无关,但事实是我们只能使用此插件通过API网关功能,日程表和云监视事件来启动状态机。
有人能指出我正确的方向吗?
谢谢
解决方法
我认为这与亚马逊国家语言的区分大小写有关。
尝试使用StartAt
更新imageWasUploadedEvent
stepFunctions:
stateMachines:
ValidateImageStateMachine:
definition:
Comment: "This state function validates the images after users upload them to S3"
StartAt: imageWasUploadedEvent
States:
imageWasUploadedEvent:
Type: Task
Resource:
Fn::GetAtt: [imagewasuploadedevent,Arn]
End: true