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

Member must satisfy regular expression pattern #1545

Open
jaykay opened this issue Jun 25, 2018 · 0 comments
Open

Member must satisfy regular expression pattern #1545

jaykay opened this issue Jun 25, 2018 · 0 comments

Comments

@jaykay
Copy link

jaykay commented Jun 25, 2018

Context

If you use Zappa for deploying a Lambda which listens to for example EC2 Events from Cloudwatch. The target for the Event Rule gets the lambda arn as Target Id. Which is invalid as it should match the pattern mentioned in the AWS Docs

Expected Behavior

It should work ;-)

Actual Behavior

It doesn't:

botocore.exceptions.ClientError: An error occurred (ValidationException) when calling the PutTargets operation: 2 validation errors detected: Value 'arn:aws:lambda:[My-Awesome-Region]:[MY ACCOUNT ID:function:my-function-name' at 'targets.1.member.id' failed to satisfy constraint: Member must satisfy regular expression pattern: [\.\-_A-Za-z0-9]+; Value 'arn:aws:lambda:[My-Awesome-Region]:[MY ACCOUNT ID:function:my-function-name' at 'targets.1.member.id' failed to satisfy constraint: Member must have length less than or equal to 64

Possible Fix

The problem seems to lie in https://github.com/Miserlou/Zappa/blob/d99c193e32733946fb52a4f9b2bdfd1d2929ba49/zappa/utilities.py#L267 where the name is set to the lambda_arn, which is invalid in this case.

Steps to Reproduce

  1. Try to deploy a lambda only project apigateway_enabled: false

Your Environment

  • Zappa version used: 0.46.0
  • Operating System and Python version: Python 3.6
  • The output of pip freeze:
argcomplete==1.9.3
awsume==3.2.8
base58==1.0.0
boto3==1.7.41
botocore==1.10.41
certifi==2018.4.16
cfn-flip==1.0.3
chardet==3.0.4
click==6.7
colorama==0.3.9
docutils==0.14
durationpy==0.5
future==0.16.0
hjson==3.0.1
idna==2.7
jmespath==0.9.3
kappa==0.6.0
lambda-packages==0.20.0
placebo==0.8.1
psutil==5.4.6
python-dateutil==2.6.1
python-slugify==1.2.4
PyYAML==3.12
requests==2.19.1
s3transfer==0.1.13
six==1.11.0
toml==0.9.4
tqdm==4.19.1
troposphere==2.3.0
Unidecode==1.0.22
urllib3==1.23
virtualenv==16.0.0
Werkzeug==0.14.1
wsgi-request-logger==0.4.6
Yapsy==1.11.223
zappa==0.46.0
  • Your zappa_settings.yaml:
dev:
  app_function: "my_module.lambda_handler"
  apigateway_enabled: false
  aws_region: "eu-central-1"
  project_name: "my-lambda"
  events:
    - function: ami_cleaner.lambda_handler
      event_source:
        arn: arn:aws:events:eu-central-1:1234567890:rule/ec2-notifier
        enabled: true
        pattern: "{\"source\": [\"aws.ec2\"], \"detail-type\": [\"EC2 Instance State-change Notification\"]}"
        events:
          - ""
  runtime: "python3.6"
  async_resources: false
  cloudwatch_log_level: "INFO"
  delete_s3_zip: false
  s3_bucket: "my-cool-bucket-for-stuff-and-things"
  manage_roles: false
  role_name: my-cool-role
  debug: true
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