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?

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南