How to mock CodeBuild with Step Functions Local

0

Hi, Does Step Functions Local support CodeBuild? I have a step in my state machine which starts as follows:

"StartBuild": { "Type": "Task", "Resource": "arn:aws:states:::codebuild:startBuild.sync", "Parameters": { "ProjectName": "${project_name}", etc.

I'm mocking the response from this step to have StatusCode 200 in my MockConfigFile.json. When I run this in Step Functions Local, my Docker container gives this error: The provided ARN 'arn:aws:states:us-east-1:123456789012:codebuild:startBuild.sync' is invalid.

Is there any advice on how to mock this step?

已提问 1 个月前134 查看次数
1 回答
1

The issue might stem from an incomplete definition in your mock configuration file. If you haven't specified mocked service integration responses in the file, Step Functions Local will attempt to invoke the actual AWS service integration using the ARN provided in your state machine definition.

For instance, if your state machine includes a task with the resource ARN for an AWS CodeBuild project (arn:aws:states:::codebuild:startBuild.sync), and there's no mocked response for this task in the configuration file, Step Functions Local will try to start an actual build using the CodeBuild service. This explains the error message you're encountering: The provided ARN 'arn:aws:states:us-east-1:123456789012:codebuild:startBuild.sync' is invalid. because the mocked service integration responses were not found.

Try to check the Key sources to properly construct your mock configuration file.

Key sources:

profile picture
专家
已回答 1 个月前
  • Thanks for your reply - I've been working from those resources and my MockConfigFile.json already looks like so: "MockedStartBuildSuccess":{ "0": { "Return": { "StatusCode": 200 "BuildId": "testid" } } }, I am still getting the same error. If I swap this CodeBuild stage for a Lambda function the step passes. Do the return arguments need to be different for CodeBuild, or is this CodeBuild resource not supported by Step Functions Local?

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则