-
Notifications
You must be signed in to change notification settings - Fork 4k
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_apigateway): Requests route to proxy for resources defined by RestApi.from_rest_api_attributes #16000
Comments
When you import existing resources, you are returning an interface rather than the actual construct. Note how the IRestApi doesn't have an Regardless of that, according to our docs you are not able to modify imported resources:
|
Something unexpected is happening then because this does deploy correctly and resources are added to the API Gateway. The request is not actually routed to those created resources but to the /{+proxy} endpoint In fact it seems this feature was implemented specifically for IRestApi #8270 Perhaps this is unexpected behavior due to the exceptional nature of the feature? |
Ah yes this is a special case, I remember this now. You have to use the
You don't specify the |
Ah sorry, I tried to simplify the example in order to make it more clear but forgot to include Note I just deployed the example and was able to observe the issue. What's really interesting though is that if you make a subsequent change to the stack containing the rest API, in this case, Example: Deploy
observe invocation of Update the code to the below and deploy ApiResourceStack again
Observe that now invocations of |
Thank you very much for clarifying and for the reproduction steps. I've been able to reproduce this issue exactly how you've described it.
@nija-at I'm curious about what's happening here, can you take a look at this when you get the chance? |
@nija-at Wanted to follow up and see when you have time to look at this? Currently this issue stands in the way of deploying new API resources independently. Thanks! |
Hi folks. This is a major blocker for us. Can someone take a look? |
Looks like this is because of the limitation of The The There are two options here - (1) Don't use (2) Disable the automatic deployment creation in const deployStack = new Stack(app, 'DeployStack');
const deployimported = RestApi.fromRestApiAttributes(barFunction, 'ImportedApi', { ... });
const deployment = new Deployment(deployStack, 'Deployment', { api: deployimported });
const logicalId = // salted id
const cfnDeployment = deployment.node.defaultChild as CfnDeployment;
cfnDeployment.overrideLogicalId(logicalId); The value of the Can you check if something like this works? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
When defining a RestApi CDK resources via
aws_apigateway.RestApi.from_rest_api_attributes
any resources added to the API where the Integration Request is a Lambda Proxy result in a method request path of {proxy=bar} when it should be a method request path of {} and route to the defined resource+lambda.Reproduction Steps
What did you expect to happen?
Lambda function on /bar resource to invoke
What actually happened?
API returns attempts to invoke {+proxy} path resulting in 500 error
Environment
Other
Note there is clearly a GET /bar method + resource on the API gateway displayed in the AWS console.
API execution logs
The lambda that is created gets two Policy Statements under Resource-based policy assigned like
and
I noticed that methods with Lambda Integrations defined in the same stack as the one where the RestApi is created do not have these Policy Statements
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: