diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts index f3987cc0677ae..34f1bd78fe3c2 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/lib/aws-sdk/call-aws-service.ts @@ -64,6 +64,10 @@ export class CallAwsService extends sfn.TaskStateBase { constructor(scope: Construct, id: string, private readonly props: CallAwsServiceProps) { super(scope, id, props); + if (this.props.integrationPattern === sfn.IntegrationPattern.RUN_JOB) { + throw new Error('The RUN_JOB integration pattern is not supported for CallAwsService'); + } + this.taskPolicies = [ new iam.PolicyStatement({ resources: props.iamResources, diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts b/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts index d3b9e3e0d42ba..da26dc7d8450e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/aws-sdk/call-aws-service.test.ts @@ -146,3 +146,16 @@ test('with unresolved tokens', () => { Parameters: {}, }); }); + +test('throws with invalid integration pattern', () => { + expect(() => new tasks.CallAwsService(stack, 'GetObject', { + integrationPattern: sfn.IntegrationPattern.RUN_JOB, + service: 's3', + action: 'getObject', + parameters: { + Bucket: 'my-bucket', + Key: sfn.JsonPath.stringAt('$.key'), + }, + iamResources: ['*'], + })).toThrow(/The RUN_JOB integration pattern is not supported for CallAwsService/); +});