Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stepfunctions): task token integration cannot be used with API Gateway #18595

Merged
merged 9 commits into from
Jan 25, 2022

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Jan 21, 2022

To pass the Task Token in headers to an API Gateway, the token must
be wrapped in an array (because that's the value type of headers).

Because JSONPath evaluation needs to happen to resolve the token,
we need to use the States.Array() function in a JsonPathToken
to properly resolve this. However, doing that makes the existing
validation code fail the validation checking that you are passing
the task token somewhere.

Add convenience methods for the intrinsics, and update the checker
to also find paths referenced inside intrinsic functions.

Fixes #14184, fixes #14181.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

…teway

To pass the Task Token in headers to an API Gateway, the token must
be wrapped in an array (because that's the value type of headers).

Because JSONPath evaluation needs to happen to resolve the token,
we need to use the `States.Array()` function in a `JsonPathToken`
to properly resolve this. However, doing that makes the existing
validation code fail the validation checking that you are passing
the task token somewhere.

Add convenience methods for the intrinsics, and update the checker
to also find paths referenced inside intrinsic functions.

Fixes #14184, fixes #14181.
@rix0rrr rix0rrr requested a review from a team January 21, 2022 14:37
@rix0rrr rix0rrr self-assigned this Jan 21, 2022
@github-actions github-actions bot added the @aws-cdk/aws-stepfunctions Related to AWS StepFunctions label Jan 21, 2022
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jan 21, 2022
@gitpod-io
Copy link

gitpod-io bot commented Jan 21, 2022

@rix0rrr rix0rrr force-pushed the huijbers/apigw-task-token branch from 9351516 to 22c439b Compare January 24, 2022 10:58
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good; some nits, mostly questions. And I think the intrinsics deserves mentioning in the readme.

@@ -305,6 +305,25 @@ const invokeTask = new tasks.CallApiGatewayRestApiEndpoint(this, 'Call REST API'
});
```

Be aware that the header values must be arrays. When passing the Task Token
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the native intrinsic function support is a feature in itself and deserves to be mentioned in the readme too.

@kaizencc kaizencc added the pr/do-not-merge This PR should not be merged at this time. label Jan 25, 2022
@rix0rrr rix0rrr removed the pr/do-not-merge This PR should not be merged at this time. label Jan 25, 2022
@mergify
Copy link
Contributor

mergify bot commented Jan 25, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 64e2d44
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@mergify mergify bot merged commit 678eede into master Jan 25, 2022
@mergify mergify bot deleted the huijbers/apigw-task-token branch January 25, 2022 20:01
@mergify
Copy link
Contributor

mergify bot commented Jan 25, 2022

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

LukvonStrom pushed a commit to LukvonStrom/aws-cdk that referenced this pull request Jan 26, 2022
…teway (aws#18595)

To pass the Task Token in headers to an API Gateway, the token must
be wrapped in an array (because that's the value type of headers).

Because JSONPath evaluation needs to happen to resolve the token,
we need to use the `States.Array()` function in a `JsonPathToken`
to properly resolve this. However, doing that makes the existing
validation code fail the validation checking that you are passing
the task token somewhere.

Add convenience methods for the intrinsics, and update the checker
to also find paths referenced inside intrinsic functions.

Fixes aws#14184, fixes aws#14181.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this pull request Feb 21, 2022
…teway (aws#18595)

To pass the Task Token in headers to an API Gateway, the token must
be wrapped in an array (because that's the value type of headers).

Because JSONPath evaluation needs to happen to resolve the token,
we need to use the `States.Array()` function in a `JsonPathToken`
to properly resolve this. However, doing that makes the existing
validation code fail the validation checking that you are passing
the task token somewhere.

Add convenience methods for the intrinsics, and update the checker
to also find paths referenced inside intrinsic functions.

Fixes aws#14184, fixes aws#14181.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-stepfunctions Related to AWS StepFunctions contribution/core This is a PR that came from AWS.
Projects
None yet
3 participants