-
Notifications
You must be signed in to change notification settings - Fork 2.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
Create apigateway permissions from openapi definitions #2211
Comments
Thanks for the feature proposal. Transferring to SAM repo. |
Agree. It's nice to be able to create the Lambda's automatically from the openapi spec. But annlying that you then have to create the permission manually. |
Any update on this? Would be nice to have this feature. |
Hi @tirumerla, thanks for reminder about this feature request. I'll add it to the team's feature list for discussion. As a workaround, our team has introduced SAM Connector. Here is an example of a api gateway to lambda function permission using SAM Connector
For see a full list of supported connection and permissions, please take a look at this link here |
Thanks @GavinZZ, will test it let you know if we any questions. |
Hey @GavinZZ , we are constantly running into "internal failure" when using connectors like this. If i comment out couple of them and deploy that seems to be working fine and uncommenting and deploying again works fine. I tried adding DependsOn as well to make sure there are no race conditions with ApiGatewayStage or anything. Wondering if you have any idea on why this could be.
Tried checking cloudtrail no errors there. Error
|
Hi @tirumerla thanks for reporting the issues. Would you be able to provide me with the full error messages? Also curious which region are you deploying the template to? Meanwhile I will try to create a template that's similar to yours and see if I can reproduce the issue. |
Hey @GavinZZ , Thanks for your response. Unfortunately this is the only error i see in the cloudformation stack when deploying. I tried adding "DependsOn" to see if it's race condition doesn't seem to help. I tried commenting three destinations with ssm store it started to work and then uncommenting and redeploying works as well so not really sure if there is any limitations to number of destinations you can use for a single connector logical id. For reference we have |
@tirumerla When the deployment failed, if you navigate the CloudForamtion console and find the stack that you tried to deploy but in |
Also curious if you use single destination format, would you still experience the same issue?
|
This is how i got the "internal failure" error here :) yeah unfortunately it just gave "Internal Failure" nothing else on the connector.
I haven't tested but heard from another teammate of mine that he split |
Hey @GavinZZ just to update you , i created a test template by splitting connectors that seems to be work fine. I only tested once waiting for few more days to see if this complains again. So far it's looking god, do you think it's the limitation of number of connectors? |
That's great to know that there is a working workaround for this issue. Unfortunately I was not able to reproduce this issue with my custom template. I also used a multi destination connectors in my template with 80+ connections in one single connector. I was able to successfully deploy it without any issue for 10 times. I would probably need a reproducible template to deep dive into the issue. |
Thanks for testing it out, yeah it's definitely weird that seeing that worked for you. May be some race conditions somewhere not really sure, i saw sometimes connectors were getting created immediately with APIGateway Deployment thought this could be the issue initially later i added DependsOn ApiGatewayStage that didn't seem to help so not really sure. Atleast for now we have workarounds. Thanks for your help. |
Describe your idea/feature/enhancement
Hey team, recently tried building out a rest API using
AWS::Serverless::Api
and openapi via DefinitionBody. It's great having my OpenAPI schemas converted to API gateway models and validation 💯 .The only thing that's missing would be to have apigw permissions automatically created.
For example, the
Events
property onAWS::Serverless::Function
automatically creates permissions for apigw to invoke the lambda.The OpenAPI schema already defines the lambda handler via
x-amazon-apigateway-integration
, so it should be possible to create this permission in the background.Proposal
Parse the DefinitionBody of
AWS::Serverless::Api
and create aAWS::Lambda::Permission
resource for the attached lambda function.Things to consider:
The text was updated successfully, but these errors were encountered: