(stepfunction-tasks): CallApiGatewayHttpApiEndpoint does not support InputPath for apiPath
- Dominant language
- TypeScript
- Stars
- 12.9k
- Forks
- 4.6k
- Avg merge
- 2d 3h
- Merged PRs (30d)
- 83
Description
We want to make a API call with path parameters that we want pass by input path.
For example like: "classA/{classA_Id}/classB/{classB_id}", for the classA_Id and classB_id, we want pass by step input path.
we use the State.format to generate the API path like
```
const getApiPath = new sfn.Pass(this, `Get Api Path`, {
parameters: {
"apiPath.$": `States.Format('/classA/{}/classB/{}', $.classA_Id, $.classB_id)`,
},
resultPath: "$.service",
});
```
we use `apiPath: "$.service.apiPath"` in CallApiGatewayHttpApiEndpoint, since I found we need using the "$." to generate the Parameters key with ".$" in here
https://github.com/aws/aws-cdk/blob/8a949dc24b13f8b7da17c102501050bac7323bf7/packages/%40aws-cdk/aws-stepfunctions/lib/json-path.ts#L159-L171
But in the state machines I generated, it didn't include the ".$" in the path Key.
### Reproduction Steps
```
new sfn_tasks.CallApiGatewayHttpApiEndpoint(this, "call ApiGateway HttpApi Endpoint", {
api: HttpApi.fromHttpApiAttributes(this, "call ApiGateway HttpApi Endpoint ", { httpApiId: http_api_id}),
stageName: "Alpha",
apiPath: "$.service.apiPath",
heartbeat: cdk.Duration.seconds(10),
integrationPattern: sfn.IntegrationPattern.REQUEST_RESPONSE,
method: sfn_tasks.HttpMethod.POST,
timeout: cdk.Duration.minutes(2),
authType: sfn_tasks.AuthType.IAM_ROLE,
});
```
### What did you expect to happen?
Generate the Path key should include the ".$"
```
"Parameters": {
...
"Path.$": "$.service.apiPath";
...
}
```
endpoint should looks like `api-id.execute-api.us-east-1.amazonaws.com/classA/classA_id/classB/clasB_id`
### What actually happened?
Generate the Path key didn't include the ".$"
```
"Parameters": {
...
"Path": "$.service.apiPath";
...
}
```
And the endpoint will looks like `api-id.execute-api.us-east-1.amazonaws.com/$.service.apiPath`
### Environment
CDK CLI Version : mono CDK 1.97.0
Framework Version:
Node.js Version: v12.5.0
OS :
Language (Version): TypeScript
### Other
---
This is :bug: Bug Report
Contributor guide
Research direction
The issue points to packages/@aws-cdk/aws-stepfunctions/lib/json-path.ts and the CallApiGatewayHttpApiEndpoint task; start by tracing how apiPath becomes the synthesized Parameters object. Verify that the generated state machine emits Path.$ for the input path and produces the expected endpoint for the example, using the task's existing tests if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100