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

(integ-tests-alpha): cannot assert awsApiCall with @aws-sdk/client-api-gateway:TestInvokeMethodCommand #32635

Open
1 task
iliapolo opened this issue Dec 22, 2024 · 1 comment
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@iliapolo
Copy link
Contributor

Describe the bug

When defining an awsApiCall assertion on an API gateway resource using the TestInvokeMethodCommand action, the assertion fails with a permissions error.

Regression Issue

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

Last Known Working CDK Version

No response

Expected Behavior

Expected the call to succeed

Current Behavior

Getting a permissions error. See how its looking for the apigateway:POST action to be present in the policy.

...is not authorized to perform: apigateway:POST on resource...

Reproduction Steps

const api = ... // define a rest api gateway

integ.assertions.awsApiCall('@aws-sdk/client-api-gateway', 'TestInvokeMethodCommand', {
  restApiId: api.restApiId,
  resourceId: 'resourceId',
  httpMethod: 'POST',
  pathWithQueryString: '/path',
}, ['Body']);

Possible Solution

In this case, the policy should be derived from the httpMethod parameter, and not the API command. Its not great because it completely diverges from the regular code path and introduces very special handling.

Additional Information/Context

No response

CDK CLI Version

2.173.2 (build f8e6207)

Framework Version

2.173.1

Node.js Version

v18.20.4

OS

Mac

Language

TypeScript

Language Version

5.7.2

Other information

No response

@iliapolo iliapolo added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Dec 22, 2024
@github-actions github-actions bot added the @aws-cdk/assertions Related to the @aws-cdk/assertv2 package label Dec 22, 2024
@iliapolo iliapolo added p2 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. @aws-cdk/assertions Related to the @aws-cdk/assertv2 package labels Dec 22, 2024
@go-to-k
Copy link
Contributor

go-to-k commented Dec 22, 2024

(Sorry, I mistakenly tied this issue to the PR above. Please ignore it...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

No branches or pull requests

2 participants