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

API Gateway Resource Policy limits with too many scheduled events #1299

Open
aleontiev opened this issue Jan 23, 2024 · 2 comments
Open

API Gateway Resource Policy limits with too many scheduled events #1299

aleontiev opened this issue Jan 23, 2024 · 2 comments

Comments

@aleontiev
Copy link

aleontiev commented Jan 23, 2024

Context

On a recent deployment, I hit this error:

An error occurred (PolicyLengthExceededException) when calling the AddPermission operation: The final policy size (20698) is bigger than the limit (20480).

When looking at the policy, I can see that Zappa is creating one policy entry for each task, e.g:

{
  "StringEquals": {
    "AWS:SourceAccount": "$AWS_ACCOUNT_ID"
  },
  "ArnLike": {
    "AWS:SourceArn": "arn:aws:events:$AWS_REGION:$AWS_ACCOUNT_ID:rule/$AWS_LAMBDA_FUNCTION_NAME.$APP_TASK_NAME"
  }
}

I know this is an AWS limit and not strictly a Zappa issue, but I wonder if there can be a more efficient way to handle these permissions so that larger functions can support more events.

Possible Fix

Either one of these:

a) (preferred, better UX for users) a policy generator that uses a wildcard in the SourceArn so that all events can be supported by a single clause in the policy

b) (easier implementation for Zappa) a way to disable automatic API Gateway Resource Policy management in Zappa so that users can manage the policy manually

@aleontiev
Copy link
Author

Bump, any thoughts? Still running into this, so far I was able to find a few old/redundant jobs to consolidate, but hoping for a longer term solution..

@aleontiev
Copy link
Author

Any support for this issue or interest in accepting a PR? I am working around it in a fork

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

1 participant