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

aws-stepfunctions-tasks: CallApiGatewayRestApiEndpoint assumes StateMachine and the API Gateway are in the same region #32289

Closed
1 task
fulcus opened this issue Nov 26, 2024 · 6 comments
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Comments

@fulcus
Copy link

fulcus commented Nov 26, 2024

Describe the bug

This code assumes that the API GW is in the same region as the step function, and there is no way to specify any other region.

return `${this.props.api.restApiId}.execute-api.${apiStack.region}.${apiStack.urlSuffix}`;

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

Be able to specify the region of the API GW.

Current Behavior

Construct assumes that SFn and API GW are in the same region.

Reproduction Steps

Read the code and try to use the CallApiGatewayRestApiEndpoint with an API in another region.

Possible Solution

A good fix would be to add the region as props to RestApi.fromRestApiAttributes, and use that to get the endpoint. Alternatively pass the region as props to CallApiGatewayRestApiEndpoint.

Additional Information/Context

No response

CDK CLI Version

2.162.1

Framework Version

No response

Node.js Version

18

OS

15.1

Language

TypeScript

Language Version

No response

Other information

No response

@fulcus fulcus added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2024
@github-actions github-actions bot added the package/tools Related to AWS CDK Tools or CLI label Nov 26, 2024
@fulcus fulcus changed the title (module name): (short issue description) aws-stepfunctions-tasks: CallApiGatewayRestApiEndpoint assumes StateMachine and the API Gateway are in the same region Nov 26, 2024
@khushail khushail added investigating This issue is being investigated and/or work is in progress to resolve the issue. p2 and removed needs-triage This issue or PR still needs to be triaged. labels Nov 27, 2024
@khushail khushail self-assigned this Nov 27, 2024
@khushail
Copy link
Contributor

Hi @fulcus , thanks for reaching out. for cross-region support , we have this- CallAwsServiceCrossRegion and CallAWSServiceCrossRegionProps. Is this what you are looking for ?

@khushail khushail added response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Nov 27, 2024
@fulcus
Copy link
Author

fulcus commented Nov 27, 2024

Hi, thanks for the response. That would surely work as a workaround, however it would be nice to have the native task allow the region option. But it seems that it should be rather integrated in all tasks, probably in the base class. Is this something you are planning to do?

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Nov 28, 2024
@khushail
Copy link
Contributor

@fulcus , I am not really sure about this .
Requesting core team to provide inputs here as this is something being considered to be implemented in future or request to share insights on the issue analysis.

@khushail khushail removed their assignment Nov 28, 2024
@aaythapa
Copy link
Contributor

Hi there, thanks for opening this issue.

I agree with @khushail that you should use the CallAwsServiceCrossRegion to perform cross-region AWS API calls. CallAwsServiceCrossRegion simplifies the process by automatically creating the necessary custom resource and allowing you to define IAM policies, actions, and other configurations.

don’t believe enabling cross-region API calls is as straightforward as simply adding a region property to the base class (though I could be wrong). CallAwsServiceCrossRegion is the preferred way to handle this use case.

Let me know if you have any questions!

@aaythapa aaythapa added the response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days. label Feb 11, 2025
@aaythapa
Copy link
Contributor

aaythapa commented Feb 12, 2025

Looks like there is already an issue: #26509 and a PR: #33252 related to this problem. Going to close this as its a duplicate and continue discussions in that PR/issue.

Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
@aws-cdk/aws-stepfunctions-tasks bug This issue is a bug. p2 package/tools Related to AWS CDK Tools or CLI response-requested Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Projects
None yet
Development

No branches or pull requests

3 participants