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

SQS event creating when it should be updating #1317

Open
lmuther8 opened this issue Mar 29, 2024 · 2 comments
Open

SQS event creating when it should be updating #1317

lmuther8 opened this issue Mar 29, 2024 · 2 comments
Labels
needs-review Needs attention from a maintainer

Comments

@lmuther8
Copy link
Contributor

Context

The function status on line 354 of utilities.py does not properly handle the AccessDeniedException from AWS.

def status(self, function):
    response = None
    LOG.debug("getting status for event source %s", self.arn)
    uuid = self._get_uuid(function)
    if uuid:
        try:
            response = self._lambda.call("get_event_source_mapping", UUID=self._get_uuid(function))
            LOG.debug(response)
        except botocore.exceptions.ClientError:
            LOG.debug("event source %s does not exist", self.arn)
            response = None
    else:
        LOG.debug("No UUID for event source %s", self.arn)
    return response

If the user does not have permissions to use lambda:GetEventSourceMapping API call then this still says the event source does not exist.

Expected Behavior

The zappa update {{stage}} command should fail and alert the user their permissions are not enough.

Actual Behavior

The program thinks the event source does not exist, tries to create one with the same UUID and then this error is caused:

botocore.errorfactory.ResourceConflictException: An error occurred (ResourceConflictException) when calling the CreateEventSourceMapping operation: An event source mapping with SQS arn (" arn:aws:sqs:us-west-2:<account>:<sqs_name> ") and function (" <function_name> ") already exists. Please update or delete the existing mapping with UUID <uuid>

Steps to Reproduce

  1. Successfully deploy an app with a SQS event source.
  2. Create a user or role with the following AWS permissions:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "lambda:ListEventSourceMappings",
                "lambda:CreateEventSourceMapping"
            ],
            "Resource": "*"
        },
        {
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": [
                "iam:GetRole",
                "lambda:UpdateFunctionCode",
                "s3:PutObject",
                "s3:GetObject",
                "iam:PassRole",
                "lambda:GetFunction",
                "lambda:UpdateFunctionConfiguration",
                "lambda:GetFunctionConfiguration",
                "lambda:GetAlias",
                "lambda:GetPolicy",
                "lambda:PutFunctionConcurrency"
            ],
            "Resource": [
                "arn:aws:iam::187760472520:role/*",
                "arn:aws:lambda:*:187760472520:event-source-mapping:*",
                "arn:aws:lambda:*:187760472520:function:*",
                "arn:aws:s3:::*/*"
            ]
        },
        {
            "Sid": "VisualEditor2",
            "Effect": "Allow",
            "Action": "s3:ListBucket",
            "Resource": "arn:aws:s3:::*"
        }
    ]
}

Your Environment

  • Zappa version used: 0.58.0
  • Operating System and Python version: MacOS Python 3.11
Copy link

Hi there! Unfortunately, this Issue has not seen any activity for at least 90 days. If the Issue is still relevant to the latest version of Zappa, please comment within the next 10 days if you wish to keep it open. Otherwise, it will be automatically closed.

@github-actions github-actions bot added the no-activity [Bot] Closing soon if no new activity label Jun 27, 2024
@lmuther8
Copy link
Contributor Author

lmuther8 commented Jul 6, 2024

This issue still exists

@github-actions github-actions bot added needs-review Needs attention from a maintainer and removed no-activity [Bot] Closing soon if no new activity labels Jul 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Needs attention from a maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant