Currently I'm trying to write a stack in CDK that creates an API Gateway and has one of the methods call an AWS Step Function to execute.
The code builds with npm run build
, but during cdk deploy I get the error:
"AWS ARN for integration contains invalid action" and errors on the line that creates the root of the API.
// API Gateway Resources
const dapi = new api.RestApi(this, 'Test-Gateway');
const testID = dapi.root.addResource('{testID}');
const getQuote = testID.addResource('GetQuote');
getQuote.addMethod('POST', new api.AwsIntegration({
service: 'states',
action: 'Start Execution',
proxy: false,
integrationHttpMethod: 'POST',
options: {
passthroughBehavior: api.PassthroughBehavior.NEVER,
credentialsRole: iam.Role.fromRoleArn(this, 'rolename', 'arnForExecutionRole'),
requestTemplates: {
'application/json': `{
"input": "{
\"Alias\": \"$input.params('Alias')\"
},
"stateMachineArn": "stateMachineArn"
}`,
},
integrationResponses: [{
statusCode: '200',
}]
}
}), {
methodResponses: [{
statusCode: '200',
}]
}
);
Im not sure why this doesn't work, as this is the same structure of a functioning one I built in the console. I feel I am either missing a parameter or has some parameter with an incorrect value. I haven't found any example of this so any help would be appreciated.
Try to use action name without spaces, ie action: 'StartExecution'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.