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

Allow Imported Lambda to create Permission #1709

Closed
tjsteinhaus opened this issue Feb 7, 2019 · 6 comments
Closed

Allow Imported Lambda to create Permission #1709

tjsteinhaus opened this issue Feb 7, 2019 · 6 comments

Comments

@tjsteinhaus
Copy link

I currently have 2 stacks. One for my Lambda's and the second for my API Gateway routes. When I import the lambda into my API Gateway stack and append it to a route, it creates the link between the Lambda and API but it doesn't add the appropriate permissions to invoke the lambda.

I was able to get around this by opening the aws-lambda module and changing the ImportedFunction property canCreatePermissions to true.

What is the main reason this isn't set to true and/or why can we not set this ourselves?

I think to organize stacks more appropriately aka a stack for Lambda's and a stack for routes, this would need to be set to true.

@eladb
Copy link
Contributor

eladb commented Feb 11, 2019

If these two stacks are defined in the CDK app, you actually don't need to use import when you reference the lambda from the routes stack. We have recently released implicit cross stack references.

I am closing for now, please let us know if this works for you.

@eladb eladb closed this as completed Feb 11, 2019
@tjsteinhaus
Copy link
Author

If I don't import the lambda in the api stack and just append it to the route itself, I get a Cyclic Dependency error.

I will fiddle around a bit more tonight to see if I can get it working.

@eladb
Copy link
Contributor

eladb commented Feb 11, 2019

Copy: @rix0rrr I think we have another one of those cyclic deps use cases. Any systemic way we can identify these you think?

@tjsteinhaus
Copy link
Author

When I get home from the office tonight I'll create a repo with this error.

@seawatts
Copy link

I am seeing the exact same issue here.

@vertti
Copy link

vertti commented Aug 7, 2019

Stumbled to this same issue still. Two stacks, one for lambdas, the other for API Gateway. Creates a cyclic dependency:

Error: 'ipk-PostiKioskiBackendStack-development' depends on 'ipk-PostiKioskiLambdaStack-development' (ipk-PostiKioskiBackendStack-development/ipk-SendItemEndpoint-development/Default/config/{kiosk_id}/GET/Resource -> ipk-PostiKioskiLambdaStack-development/ipk-ConfigLambda-development/Resource.Arn). Adding this dependency (ipk-PostiKioskiLambdaStack-development/ipk-ConfigLambda-development/ApiPermission.GET..config.{kiosk_id} -> ipk-PostiKioskiBackendStack-development/ipk-SendItemEndpoint-development/Resource.Ref) would create a cyclic reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants