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?

asked a month ago118 views
1 Answer
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
EXPERT
answered a month ago
  • 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?

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions